HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulelibsodium-bindings-0.0.1.1Haskell2010

LibSodium.Bindings.ShortHashing

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.

  • 8 values

Functions

4 declarations
valuecryptoShortHash
  1. :: Ptr CUChar

    Buffer that will hold the fingerprint, of size cryptoShortHashBytes.

  2. -> Ptr CUChar

    Buffer that holds the input message.

  3. -> CULLong

    Length of the input message.

  4. -> Ptr CUChar

    Buffer that holds the secret key, of size cryptoShortHashKeyBytes.

  5. -> IO CInt

    The 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()

valuecryptoShortHashX24
  1. :: Ptr CUChar

    Buffer that will hold the fingerprint, of size cryptoShortHashSipHashX24Bytes.

  2. -> Ptr CUChar

    Buffer that holds the input message.

  3. -> CULLong

    Length of the input message.

  4. -> Ptr CUChar

    Buffer that holds the secret key, of size cryptoShortHashSipHashX24KeyBytes.

  5. -> IO CInt

    The 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.

See: crypto_shorthash_siphashx24()

Constants

4 declarations