crypto_generichash()
function puts a fingerprint of the message in
whose length is inlen
bytes into out
. The output size can be chosen by the application.crypto_generichash_BYTES
. This size makes it practically impossible for two messages to produce the same fingerprint.crypto_generichash_BYTES_MIN
(included) and crypto_generichash_BYTES_MAX
(included).key
can be NULL
and keylen
can be 0
. In this case, a message will always have the same fingerprint, like the MD5
or SHA-1
functions for which crypto_generichash()
is a faster and more secure alternative.crypto_generichash_KEYBYTES
bytes.0
(included) and crypto_generichash_KEYBYTES_MAX
(included). If the key is meant to be secret, the recommended minimum length is crypto_generichash_KEYBYTES_MIN
.generichash
operation also supports a streaming API.crypto_generichash_init()
function initializes a state state
with a key key
(that can be NULL
) of length keylen
bytes to eventually produce outlen
bytes of output.crypto_generichash_update()
, providing the previously initialized state state
, a pointer to the chunk in
, and the length of the chunk in bytes, inlen
.crypto_generichash_final()
function completes the operation and puts the final fingerprint into out
as outlen
bytes.crypto_generichash_final()
returns, the state should not be used any more, unless it is reinitialized using crypto_generichash_init()
.crypto_generichash_keygen()
function creates a key k
of the recommended length crypto_generichash_KEYBYTES
.crypto_generichash_BYTES
crypto_generichash_BYTES_MIN
crypto_generichash_BYTES_MAX
crypto_generichash_KEYBYTES
crypto_generichash_KEYBYTES_MIN
crypto_generichash_KEYBYTES_MAX
crypto_generichash_state
crypto_generichash_*
function set is implemented using BLAKE2b, a simple, standardized (RFC 7693), and secure hash function that is as strong as SHA-3 but faster than MD5 and SHA-1.crypto_generichash_blake2b.h
.crypto_pwhash
API documented in the Password Hashing section.