riclava/blake2b

I want to use Blake2b's second constructor.

Closed this issue · 2 comments

Tand0 commented
  • Currently Blake2b can only call one constructor.

  • But I want to call the second constructor.

  • That's why I want it to be a named constructor.

  • I also want to be able to accept null as a parameter.

  • Specifically, modify it as follows.

=Before===============
  blake2b(final Uint8List key, final int digestSize, final Uint8List salt, final Uint8List personalization) {
=After================
  Blake2b.blake2b(final Uint8List? key, final int digestSize, final Uint8List? salt, final Uint8List? personalization) {
======================

The test code is shown following.

    String preSalt = .....
    int digestSize = 16;
    Uint8List bPreSalt = Uint8List.fromList(preSalt.codeUnits);
    Uint8List salt = Uint8List(digestSize);
    final Blake2b blake2b = Blake2b.blake2b(null, digestSize, null, null);
    blake2b.update(bPreSalt, 0, bPreSalt.length);
    blake2b.digest(salt, 0);

Thanks you for suggestion
already published https://github.com/riclava/blake2b/tree/v0.2.3

Thank you!