deriveKey function
Implementation
Uint8List deriveKey(Digest algo, Uint8List sessionId, Uint8List exH, BigInt K,
int id, int bytes) {
Uint8List ret = Uint8List(0);
while (ret.length < bytes) {
Digester digest = Digester(algo);
digest.updateBigInt(K);
digest.updateRaw(exH);
if (ret.isEmpty) {
digest.updateByte(id);
digest.updateRaw(sessionId);
} else {
digest.updateRaw(ret);
}
ret = Uint8List.fromList(ret + digest.finish());
}
return viewUint8List(ret, 0, bytes);
}