pubKeyFromSecret static method

Uint8List pubKeyFromSecret(
  1. Uint8List secretKey
)

Implementation

static Uint8List pubKeyFromSecret(Uint8List secretKey) {
  final d = Uint8List(64);
  final p = [Int32List(16), Int32List(16), Int32List(16), Int32List(16)];
  final 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;
  Ed25519Blake2b._scalarbase(p, d, 0);
  Ed25519Blake2b._pack(pk, p);
  return pk;
}