calculateKey static method

BigInt calculateKey(
  1. Digest digest,
  2. BigInt N,
  3. BigInt? S
)

Computes the final Key according to the standard routine: Key = H(S) digest The Digest used as the hashing function H N Modulus used to get the pad length S The secret calculated by both sides @return the final Key value.

Implementation

static BigInt calculateKey(Digest digest, BigInt N, BigInt? S) {
  var padLength = (N.bitLength + 7) ~/ 8;
  var S0 = getPadded(S!, padLength);
  digest.update(S0, 0, S0.length);

  var output = Uint8List(digest.digestSize);
  digest.doFinal(output, 0);
  return decodeBigInt(output);
}