HKDF constructor
HKDF({})
Implementation
factory HKDF(
{required List<int> ikm,
required HashFunc hash,
int length = 32,
List<int>? salt,
List<int>? info,
bool hkdfExtract = true}) {
final h = hash();
int iteration = (length / h.getDigestLength).ceil();
if (iteration > 255) {
throw CryptoException('Cannot expand to more than 255 blocks');
}
if (hkdfExtract) {
final ork = HMAC.hmac(hash, salt ?? List<int>.filled(32, 0), ikm);
return HKDF._(
ork: ork, info: info, hmac: HMAC(hash, ork), length: length);
}
return HKDF._(ork: ikm, hmac: HMAC(hash, ikm), info: info, length: length);
}