$finalize method
Finalizes the message digest with the remaining message block, and returns the output as byte array.
Implementation
@override
Uint8List $finalize() {
int i, t;
int hash;
if (messageLength < 32) {
hash = seed + prime64_5;
} else {
// accumulate
hash = _rotl(_acc1, 1);
hash += _rotl(_acc2, 7);
hash += _rotl(_acc3, 12);
hash += _rotl(_acc4, 18);
// merge round
hash = _merge(hash, _acc1);
hash = _merge(hash, _acc2);
hash = _merge(hash, _acc3);
hash = _merge(hash, _acc4);
}
hash += messageLength;
// process the remaining data
for (i = t = 0; t + 8 <= pos; ++i, t += 8) {
hash ^= _accumulate(0, qbuffer[i]);
hash = _rotl(hash, 27);
hash *= prime64_1;
hash += prime64_4;
}
for (i <<= 1; t + 4 <= pos; ++i, t += 4) {
hash ^= sbuffer[i] * prime64_1;
hash = _rotl(hash, 23);
hash *= prime64_2;
hash += prime64_3;
}
for (; t < pos; t++) {
hash ^= buffer[t] * prime64_5;
hash = _rotl(hash, 11);
hash *= prime64_1;
}
// avalanche
hash ^= hash >>> 33;
hash *= prime64_2;
hash ^= hash >>> 29;
hash *= prime64_3;
hash ^= hash >>> 32;
return Uint8List.fromList([
hash >>> 56,
hash >>> 48,
hash >>> 40,
hash >>> 32,
hash >>> 24,
hash >>> 16,
hash >>> 8,
hash,
]);
}