update method
Updates the hash computation with the given data.
Parameters:
data: The Containing the data to be hashed.
Implementation
@override
SerializableHash update(List<int> data, {int? length}) {
if (_finished) {
throw CryptoException.failed("SHA.update", reason: "State was finished.");
}
int dataLength = length ?? data.length;
int dataPos = 0;
_bytesHashed += dataLength;
if (_bufferLength > 0) {
while (_bufferLength < getBlockSize && dataLength > 0) {
_buffer[_bufferLength++] = data[dataPos++] & BinaryOps.mask8;
dataLength--;
}
if (_bufferLength == getBlockSize) {
_hashBlocks(_temp, _state, _buffer, 0, getBlockSize);
_bufferLength = 0;
}
}
if (dataLength >= getBlockSize) {
dataPos = _hashBlocks(_temp, _state, data, dataPos, dataLength);
dataLength %= getBlockSize;
}
while (dataLength > 0) {
_buffer[_bufferLength++] = data[dataPos++] & BinaryOps.mask8;
dataLength--;
}
return this;
}