hkdfExpand function
Implementation
Uint8List hkdfExpand({
required Uint8List prk,
required Uint8List info,
required int length,
}) {
var hashLen = 32;
int n = (length + hashLen - 1) ~/ hashLen;
var okm = <int>[];
var previous = <int>[];
for (var i = 1; i <= n; i++) {
var hmacSha256 = crypto.Hmac(crypto.sha256, prk);
var data = <int>[
...previous,
...info,
i,
];
previous = hmacSha256.convert(data).bytes;
okm.addAll(previous);
}
return Uint8List.fromList(okm.sublist(0, length));
}