libsodium_crypto_hash (libsodium v3.0.1)
View SourceThe default fixed-output hash function, currently SHA-512, producing
bytes/0 byte digests.
SHA-2 is vulnerable to length extension attacks; unless SHA-512 is
required for interoperability, prefer libsodium_crypto_generichash.
For streaming SHA-512, use libsodium_crypto_hash_sha512.
Digest = libsodium_crypto_hash:crypto_hash(<<"hello world">>),
64 = byte_size(Digest),
Digest = libsodium_crypto_hash_sha512:crypto_hash_sha512(<<"hello world">>).
Summary
Types
Functions
-spec bytes() -> Result when Result :: 64.
Return crypto_hash_bytes(), in bytes.
Hash In, returning a bytes/0 byte digest.
-spec primitive() -> Result when Result :: sha512.
Return crypto_hash_primitive() as an atom.