add method

void add(
  1. List<int> data
)

Feeds data into the digest.

Copies through the scratch buffer in bufferSize slices, so a chunk larger than the buffer is fine and costs no extra native memory.

Implementation

void add(List<int> data) {
  _ensureUsable();
  var offset = 0;
  while (offset < data.length) {
    final count = math.min(bufferSize, data.length - offset);
    _buffer.asTypedList(count).setRange(0, count, data, offset);
    if (_bindings.EVP_DigestUpdate(_ctx, _buffer.cast(), count) != 1) {
      throw OpenSslException('EVP_DigestUpdate failed');
    }
    offset += count;
    _length += count;
  }
}