KDF function
Implements key derivation function as specified in ICAO 9303 p11 Section 9.7.1
Key is derived by hash object using keySeed bytes and counter number.
Implementation
// ignore: non_constant_identifier_names
Uint8List KDF(final Hash hash, final Uint8List keySeed, final Int32 counter) {
Uint8List preimage = Uint8List(keySeed.length + 4);
preimage.setRange(0, keySeed.length, keySeed);
ByteData piview = ByteData.view(preimage.buffer);
piview.setInt32(keySeed.length, counter.toInt(), Endian.big);
return hash.convert(preimage).bytes as Uint8List;
}