AKushWarrior / steel_crypt

A collection of high-level API's exposing PointyCastle to perform hashing and encrypting in popular/secure algorithms.
https://pub.dev/packages/steel_crypt
Mozilla Public License 2.0
40 stars 10 forks source link

Hash SHA-1 not calculating right value #17

Closed timosturm closed 4 years ago

timosturm commented 4 years ago
  String type = "SHA-1";
  Uint8List hash = Digest(type).process(Uint8List.fromList([0, 0, 0, 0, 0, 0, 0, 0]));

  print('$hash');

Version: 1.6.1

Expected: [5, 254, 64, 87, 83, 22, 111, 18, 85, 89, 231, 201, 172, 85, 134, 84, 241, 7, 199, 233]

Actual: [9, 62, 67, 119, 176, 114, 197, 97, 221, 184, 28, 162, 131, 250, 208, 153, 50, 219, 150, 148]

The SHA-1 hash is used as a checksum and the calculated checksum from this library is different to the one calculated by MessageDigest on android and pointycastle 1.0.2.

AKushWarrior commented 4 years ago

Thanks for the help! I found the issue, will publish an update later today.

AKushWarrior commented 4 years ago

This is finished and published to GitHub and Pub. Thanks for reporting...