pkFromSecret static method

Uint8List pkFromSecret(
  1. Uint8List secretKey
)

Implementation

static Uint8List pkFromSecret(Uint8List secretKey) {
  Uint8List d = Uint8List(64);
  List<Uint64List?> p = List<Uint64List?>.filled(4, Uint64List(0));

  p[0] = Uint64List(16);
  p[1] = Uint64List(16);
  p[2] = Uint64List(16);
  p[3] = Uint64List(16);
  Uint8List pk = Uint8List(32);
  Blake2bDigest blake2b = Blake2bDigest(digestSize: 64);
  blake2b.update(secretKey, 0, secretKey.length);
  blake2b.doFinal(d, 0);

  d[0] &= 248;
  d[31] &= 127;
  d[31] |= 64;
  TweetNaclFast._scalarbase(p, d, 0);
  TweetNaclFast._pack(pk, p);
  return pk;
}