SimpleChecksumUpdater

Mutable checksum updater for SimpleChecksum, with a provided checksum

For example:

val checksum = SimpleChecksumUpdater(CRC32)
checksum.reset()
checksum.update(byteArrayOf(1, 2, 3, 4), 1, 2)
checksum.current

Constructors

Link copied to clipboard
constructor(checksum: SimpleChecksum)

Properties

Link copied to clipboard
Link copied to clipboard

Current checksum value

Functions

Link copied to clipboard
fun reset()

Resets the checksum to the initial value

Link copied to clipboard
fun update(data: ByteArray, offset: Int = 0, len: Int = data.size - offset): Int

Updates the checksum with the data ByteArray in the range offset and len. And returns the updated checksum.

Link copied to clipboard
inline fun updateWithRead(read: (buffer: ByteArray) -> Int): Int

Updates the checksum with the read function. And returns the updated checksum.