libsodium-bindings-0.0.1.1: FFI bindings to libsodium
Copyright(C) Hécate Moonlight
LicenseBSD-3-Clause
MaintainerThe Haskell Cryptography Group
StabilityStable
PortabilityGHC only
Safe HaskellNone
LanguageHaskell2010

LibSodium.Bindings.ShortHashing

Description

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.

Synopsis

Functions

cryptoShortHashKeyGen Source #

Arguments

:: Ptr CUChar

Buffer that will hold the secret key.

-> IO () 

Create a secret key of size cryptoShortHashKeyBytes.

It is implemented by libsodium with randombytesBuf

See: crypto_shorthash_keygen()

Since: 0.0.1.0

cryptoShortHash Source #

Arguments

:: Ptr CUChar

Buffer that will hold the fingerprint, of size cryptoShortHashBytes.

-> Ptr CUChar

Buffer that holds the input message.

-> CULLong

Length of the input message.

-> Ptr CUChar

Buffer that holds the secret key, of size cryptoShortHashKeyBytes.

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

Since: 0.0.1.0

cryptoShortHashX24KeyGen Source #

Arguments

:: Ptr CUChar

Buffer that will hold the secret key.

-> IO () 

Create a secret key of size cryptoShortHashSipHashX24KeyBytes.

It is implemented with randombytesBuf

Since: 0.0.1.0

cryptoShortHashX24 Source #

Arguments

:: Ptr CUChar

Buffer that will hold the fingerprint, of size cryptoShortHashSipHashX24Bytes.

-> Ptr CUChar

Buffer that holds the input message.

-> CULLong

Length of the input message.

-> Ptr CUChar

Buffer that holds the secret key, of size cryptoShortHashSipHashX24KeyBytes.

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

Since: 0.0.1.0

Constants

cryptoShortHashKeyBytes :: CSize Source #

Size of the key generated by cryptoShortHashKeyGen.

See: crypto_shorthash_KEYBYTES

Since: 0.0.1.0

cryptoShortHashBytes :: CSize Source #

Size of the fingerprint computed by cryptoShortHash.

See: crypto_shorthash_BYTES

Since: 0.0.1.0