hashedKeyFor method

Uint8List hashedKeyFor(
  1. K1 key1,
  2. K2 key2,
  3. K3 key3,
  4. K4 key4,
)

Implementation

Uint8List hashedKeyFor(K1 key1, K2 key2, K3 key3, K4 key4) {
  final Uint8List hash = Uint8List(32 +
      hasher1.size(key1) +
      hasher2.size(key2) +
      hasher3.size(key3) +
      hasher4.size(key4));
  Hasher.twoxx128.hashTo(
    data: Uint8List.fromList(utf8.encode(prefix)),
    output: hash.buffer.asUint8List(hash.offsetInBytes, 16),
  );
  Hasher.twoxx128.hashTo(
    data: Uint8List.fromList(utf8.encode(storage)),
    output: hash.buffer.asUint8List(hash.offsetInBytes + 16, 16),
  );
  int cursor = hash.offsetInBytes + 32;
  hasher1.hashTo(key: key1, output: hash.buffer.asUint8List(cursor));
  cursor += hasher1.size(key1);
  hasher2.hashTo(key: key2, output: hash.buffer.asUint8List(cursor));
  cursor += hasher2.size(key2);
  hasher3.hashTo(key: key3, output: hash.buffer.asUint8List(cursor));
  cursor += hasher3.size(key3);
  hasher4.hashTo(key: key4, output: hash.buffer.asUint8List(cursor));
  return hash;
}