close method
Implementation
Uint8List close() {
if (_closed) throw StateError("UHasher is already closed.");
_closed = true;
final int bitsLow = (_totalLength * 8) % 4294967296;
final int bitsHigh = (_totalLength * 8) ~/ 4294967296;
_block[_blockLength++] = 0x80;
if (_blockLength > 56) {
_block.fillRange(_blockLength, 64, 0);
_compress(_block, 0);
_blockLength = 0;
}
_block.fillRange(_blockLength, 56, 0);
final ByteData tail = ByteData.sublistView(_block);
if (algorithm == UHashAlgorithm.md5) {
tail
..setUint32(56, bitsLow, Endian.little)
..setUint32(60, bitsHigh, Endian.little);
} else {
tail
..setUint32(56, bitsHigh)
..setUint32(60, bitsLow);
}
_compress(_block, 0);
final ByteData out = ByteData(_state.length * 4);
for (int i = 0; i < _state.length; i++) {
out.setUint32(i * 4, _state[i], algorithm == UHashAlgorithm.md5 ? Endian.little : Endian.big);
}
return out.buffer.asUint8List();
}