Create a secret key of size cryptoShortHashKeyBytes.
It is implemented by libsodium with randombytesBuf
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27
Modulelibsodium-bindings-0.0.1.1Haskell2010
The short-input hashing functions have a variety of use-cases, such as:
Hash Tables
Probabilistic data structures, such as Bloom filters
Integrity checking in interactive protocols
Note however that the output of cryptoShortHash is only 64 bit. Therefore, it should not be considered resistant to collisions.
The cryptoShortHashX24 function has a 128-bit output which is more resistant to collisions.
Create a secret key of size cryptoShortHashKeyBytes.
It is implemented by libsodium with randombytesBuf
cryptoShortHash :: Ptr CUCharBuffer that will hold the fingerprint, of size cryptoShortHashBytes.
-> Ptr CUCharBuffer that holds the input message.
-> CULLongLength of the input message.
-> Ptr CUCharBuffer that holds the secret key, of size cryptoShortHashKeyBytes.
-> IO CIntThe function returns -1 if the hashing fails and 0 on success.
Hash an input message with a secret key. The secret key is of size cryptoShortHashKeyBytes and can be generated with cryptoShortHashKeyGen.
See: crypto_shorthash()
Create a secret key of size cryptoShortHashSipHashX24KeyBytes.
It is implemented with randombytesBuf
cryptoShortHashX24 :: Ptr CUCharBuffer that will hold the fingerprint, of size cryptoShortHashSipHashX24Bytes.
-> Ptr CUCharBuffer that holds the input message.
-> CULLongLength of the input message.
-> Ptr CUCharBuffer that holds the secret key, of size cryptoShortHashSipHashX24KeyBytes.
-> IO CIntThe function returns -1 if the hashing fails and 0 on success.
Hash an input message with a secret key to a 128-bit fingerprint.
The secret key can be generated with cryptoShortHashX24KeyGen.
Size of the key generated by cryptoShortHashKeyGen.
Size of the fingerprint computed by cryptoShortHash.
Size of the key generated by cryptoShortHashKeyGen.
Size of the fingerprint computed by cryptoShortHashX24.