encodeByteHmac static method

Uint8List encodeByteHmac(
  1. Uint8List key,
  2. int keylen,
  3. List<int> challenge, {
  4. dynamic hmacLength = 64,
})

Creates a hmac from a key that usually is the derived key, keylen, challenge and hmacLength.

Implementation

static Uint8List encodeByteHmac(
    Uint8List key, int keylen, List<int> challenge,
    {hmacLength = 64}) {
  var mac = HMac(SHA256Digest(), hmacLength);
  mac.init(KeyParameter(key));
  mac.update(Uint8List.fromList(challenge), 0, challenge.length);
  var out = Uint8List(keylen);
  mac.doFinal(out, 0);
  return out;
}