Digest

expect abstract class Digest : Algorithm, Copyable<Digest> , Resettable, Updatable(source)

Core abstraction for Message Digest implementations.

A Digest provides secure one-way hash functions that take in arbitrary sized data and output a fixed-length hash value.

Implementations of Digest should follow the Java naming guidelines for algorithm which can be found at:

https://docs.oracle.com/en/java/javase/11/docs/specs/security/standard-names.html#messagedigest-algorithms

actual abstract class Digest : MessageDigest, Algorithm, Cloneable, Copyable<Digest> , Resettable, Updatable(source)

Core abstraction for Message Digest implementations. Extends Java's MessageDigest for compatibility.

A Digest provides secure one-way hash functions that take in arbitrary sized data and output a fixed-length hash value.

Implementations of Digest should follow the Java naming guidelines for algorithm which can be found at:

https://docs.oracle.com/en/java/javase/11/docs/specs/security/standard-names.html#messagedigest-algorithms

actual abstract class Digest : Algorithm, Copyable<Digest> , Resettable, Updatable(source)

Core abstraction for Message Digest implementations.

A Digest provides secure one-way hash functions that take in arbitrary sized data and output a fixed-length hash value.

Implementations of Digest should follow the Java naming guidelines for algorithm which can be found at:

https://docs.oracle.com/en/java/javase/11/docs/specs/security/standard-names.html#messagedigest-algorithms

Constructors

Link copied to clipboard
protected expect constructor(algorithm: String, blockSize: Int, digestLength: Int)

Creates a new Digest for the specified parameters.

protected expect constructor(other: Digest)

Creates a new Digest from other, copying its state.

protected actual constructor(algorithm: String, blockSize: Int, digestLength: Int)

Creates a new Digest for the specified parameters.

protected actual constructor(other: Digest)

Creates a new Digest from other, copying its state.

protected actual constructor(algorithm: String, blockSize: Int, digestLength: Int)

Creates a new Digest for the specified parameters.

protected actual constructor(other: Digest)

Creates a new Digest from other, copying its state.

Functions

Link copied to clipboard
expect override fun algorithm(): String
actual override fun algorithm(): String
actual override fun algorithm(): String
Link copied to clipboard
expect fun blockSize(): Int

The number of byte blocks (in factors of 8) that the implementation requires before one round of input processing is to occur. This value is also representative of the digest's buffer size, and will always be greater than 0.

actual fun blockSize(): Int

The number of byte blocks (in factors of 8) that the implementation requires before one round of input processing is to occur. This value is also representative of the digest's buffer size, and will always be greater than 0.

actual fun blockSize(): Int

The number of byte blocks (in factors of 8) that the implementation requires before one round of input processing is to occur. This value is also representative of the digest's buffer size, and will always be greater than 0.

Link copied to clipboard
protected expect abstract fun compressProtected(input: ByteArray, offset: Int)

Called whenever a full blockSize worth of bytes are available for processing, starting at index offset for the provided input. Implementations must not alter input.

protected actual abstract fun compressProtected(input: ByteArray, offset: Int)

Called whenever a full blockSize worth of bytes are available for processing, starting at index offset for the provided input. Implementations must not alter input.

protected actual abstract fun compressProtected(input: ByteArray, offset: Int)

Called whenever a full blockSize worth of bytes are available for processing, starting at index offset for the provided input. Implementations must not alter input.

Link copied to clipboard
expect fun digest(): ByteArray

Completes the computation, performing final operations and returning the resultant array of bytes. The Digest is reset afterward.

expect fun digest(input: ByteArray): ByteArray

Updates the instance with provided input then completes the computation, performing final operations and returning the resultant array of bytes. The Digest is reset afterward.

actual override fun digest(): ByteArray

Completes the computation, performing final operations and returning the resultant array of bytes. The Digest is reset afterward.

actual override fun digest(input: ByteArray): ByteArray

Updates the instance with provided input then completes the computation, performing final operations and returning the resultant array of bytes. The Digest is reset afterward.

actual fun digest(): ByteArray

Completes the computation, performing final operations and returning the resultant array of bytes. The Digest is reset afterward.

actual fun digest(input: ByteArray): ByteArray

Updates the instance with provided input then completes the computation, performing final operations and returning the resultant array of bytes. The Digest is reset afterward.

Link copied to clipboard
expect fun digestInto(dest: ByteArray, destOffset: Int): Int

Completes the computation, performing final operations and placing the resultant bytes into the provided dest array starting at index destOffset. The Digest is reset afterward.

actual fun digestInto(dest: ByteArray, destOffset: Int): Int

Completes the computation, performing final operations and placing the resultant bytes into the provided dest array starting at index destOffset. The Digest is reset afterward.

actual fun digestInto(dest: ByteArray, destOffset: Int): Int

Completes the computation, performing final operations and placing the resultant bytes into the provided dest array starting at index destOffset. The Digest is reset afterward.

Link copied to clipboard
protected expect open fun digestIntoProtected(dest: ByteArray, destOffset: Int, buf: ByteArray, bufPos: Int)

Called to complete the computation, providing any input that may be buffered and awaiting processing.

protected actual open fun digestIntoProtected(dest: ByteArray, destOffset: Int, buf: ByteArray, bufPos: Int)

Called to complete the computation, providing any input that may be buffered and awaiting processing.

protected actual open fun digestIntoProtected(dest: ByteArray, destOffset: Int, buf: ByteArray, bufPos: Int)

Called to complete the computation, providing any input that may be buffered and awaiting processing.

Link copied to clipboard
expect fun digestLength(): Int

The number of bytes the implementation returns when digest is called.

actual fun digestLength(): Int

The number of bytes the implementation returns when digest is called.

actual fun digestLength(): Int

The number of bytes the implementation returns when digest is called.

Link copied to clipboard
protected expect abstract fun digestProtected(buf: ByteArray, bufPos: Int): ByteArray

Called to complete the computation, providing any input that may be buffered and awaiting processing.

protected actual abstract fun digestProtected(buf: ByteArray, bufPos: Int): ByteArray

Called to complete the computation, providing any input that may be buffered and awaiting processing.

protected actual abstract fun digestProtected(buf: ByteArray, bufPos: Int): ByteArray

Called to complete the computation, providing any input that may be buffered and awaiting processing.

Link copied to clipboard
expect override fun reset()
actual override fun reset()
actual override fun reset()
Link copied to clipboard
protected expect abstract fun resetProtected()
protected actual abstract fun resetProtected()
protected actual abstract fun resetProtected()
Link copied to clipboard
expect override fun update(input: Byte)
expect override fun update(input: ByteArray)
expect override fun update(input: ByteArray, offset: Int, len: Int)
actual override fun update(input: Byte)
actual override fun update(input: ByteArray)
actual override fun update(input: ByteArray, offset: Int, len: Int)
actual override fun update(input: Byte)
actual override fun update(input: ByteArray)
actual override fun update(input: ByteArray, offset: Int, len: Int)
Link copied to clipboard
protected expect open fun updateProtected(input: Byte)

Optional override for implementations to intercept cleansed input before being processed by the Digest abstraction.

protected expect open fun updateProtected(input: ByteArray, offset: Int, len: Int)

Optional override for implementations to intercept cleansed input before being processed by the Digest abstraction. Parameters passed to this function are always valid and have been checked for appropriateness.

protected actual open fun updateProtected(input: Byte)

Optional override for implementations to intercept cleansed input before being processed by the Digest abstraction.

protected actual open fun updateProtected(input: ByteArray, offset: Int, len: Int)

Optional override for implementations to intercept cleansed input before being processed by the Digest abstraction. Parameters passed to this function are always valid and have been checked for appropriateness.

protected actual open fun updateProtected(input: Byte)

Optional override for implementations to intercept cleansed input before being processed by the Digest abstraction.

protected actual open fun updateProtected(input: ByteArray, offset: Int, len: Int)

Optional override for implementations to intercept cleansed input before being processed by the Digest abstraction. Parameters passed to this function are always valid and have been checked for appropriateness.