UpdateFunction

Base interface for incremental (streaming) cryptographic operations such as hashing and signing.

Data should be fed incrementally via update, and the result could be obtained from a subtype-specific finalization method. Should be closed after use to release resources.

Inheritors

Functions

Link copied to clipboard
expect abstract fun close()
Link copied to clipboard
abstract fun reset()

Resets the accumulated state, allowing this function to be reused for a new operation without creating a new instance.

Link copied to clipboard
open fun update(source: RawSource)

Reads all available data from the source and feeds it into this function.

abstract fun update(source: ByteArray, startIndex: Int = 0, endIndex: Int = source.size)

Feeds data from the source byte array into this function. Only the portion from startIndex (inclusive) to endIndex (exclusive) is processed.

open fun update(source: ByteString, startIndex: Int = 0, endIndex: Int = source.size)

Feeds data from the source byte string into this function. Only the portion from startIndex (inclusive) to endIndex (exclusive) is processed.

Link copied to clipboard
open fun updatingSink(sink: RawSink): RawSink

Returns a RawSink wrapper around the given sink that feeds all data written through it into this function as a side effect. Useful for writing data to a sink while simultaneously computing a hash or signature.

Link copied to clipboard

Returns a RawSource wrapper around the given source that feeds all data read through it into this function as a side effect. Useful for processing data from a source while simultaneously computing a hash or signature.