crypto_sign_keypair static method

int crypto_sign_keypair(
  1. Uint8List pk,
  2. Uint8List sk,
  3. bool seeded
)

Implementation

static int crypto_sign_keypair(Uint8List pk, Uint8List sk, bool seeded) {
  Uint8List d = Uint8List(64);
  List<Int64List> p = List<Int64List>(4);

  p[0] = Int64List(16);
  p[1] = Int64List(16);
  p[2] = Int64List(16);
  p[3] = Int64List(16);

  int i;

  if (!seeded) randombytes_array_len(sk, 32);
  crypto_hash_off(d, sk, 0, 32);
  d[0] &= 248;
  d[31] &= 127;
  d[31] |= 64;

  _scalarbase(p, d, 0);
  _pack(pk, p);

  for (i = 0; i < 32; i++) sk[i + 32] = pk[i];
  return 0;
}