crypto / org.apache.tuweni.crypto.sodium / SHA256Hash

SHA256Hash

open class SHA256Hash (source)

SHA-256 hashing. The SHA-256 and SHA-512 functions are provided for interoperability with other applications. If you are looking for a generic hash function and not specifically SHA-2, using crypto_generichash() (BLAKE2b) might be a better choice.

These functions are also not suitable for hashing passwords or deriving keys from passwords. Use one of the password hashing APIs instead.

These functions are not keyed and are thus deterministic. In addition, the untruncated versions are vulnerable to length extension attacks.

See Also
<a href="https://libsodium.gitbook.io/doc/advanced/sha-2_hash_function">SHA-2</a>

Types

Hash

class Hash : Destroyable

SHA-256 hash output

Input

class Input : Destroyable

Input of a SHA-256 hash function

Constructors

<init>

SHA256Hash()

SHA-256 hashing. The SHA-256 and SHA-512 functions are provided for interoperability with other applications. If you are looking for a generic hash function and not specifically SHA-2, using crypto_generichash() (BLAKE2b) might be a better choice.

These functions are also not suitable for hashing passwords or deriving keys from passwords. Use one of the password hashing APIs instead.

These functions are not keyed and are thus deterministic. In addition, the untruncated versions are vulnerable to length extension attacks.

Functions

hash

open static fun hash(input: Input): Hash

Hashes input to a SHA-256 hash