Copyright | (C) Hécate Moonlight |
---|---|
License | BSD-3-Clause |
Maintainer | The Haskell Cryptography Group |
Stability | Stable |
Portability | GHC only |
Safe Haskell | None |
Language | Haskell2010 |
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
- cryptoShortHashKeyGen :: Ptr CUChar -> IO ()
- cryptoShortHash :: Ptr CUChar -> Ptr CUChar -> CULLong -> Ptr CUChar -> IO CInt
- cryptoShortHashX24KeyGen :: Ptr CUChar -> IO ()
- cryptoShortHashX24 :: Ptr CUChar -> Ptr CUChar -> CULLong -> Ptr CUChar -> IO CInt
- cryptoShortHashKeyBytes :: CSize
- cryptoShortHashBytes :: CSize
- cryptoShortHashSipHashX24KeyBytes :: CSize
- cryptoShortHashSipHashX24Bytes :: CSize
Functions
cryptoShortHashKeyGen Source #
Create a secret key of size cryptoShortHashKeyBytes
.
It is implemented by libsodium with randombytesBuf
See: crypto_shorthash_keygen()
Since: 0.0.1.0
:: Ptr CUChar | Buffer that will hold the fingerprint, of size |
-> Ptr CUChar | Buffer that holds the input message. |
-> CULLong | Length of the input message. |
-> Ptr CUChar | Buffer that holds the secret key, of size |
-> 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 #
Create a secret key of size cryptoShortHashSipHashX24KeyBytes
.
It is implemented with randombytesBuf
Since: 0.0.1.0
:: Ptr CUChar | Buffer that will hold the fingerprint, of size |
-> Ptr CUChar | Buffer that holds the input message. |
-> CULLong | Length of the input message. |
-> Ptr CUChar | Buffer that holds the secret key, of size |
-> 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
cryptoShortHashSipHashX24KeyBytes :: CSize Source #
Size of the key generated by cryptoShortHashKeyGen
.
See: crypto_shorthash_siphashx24_BYTES
Since: 0.0.1.0
cryptoShortHashSipHashX24Bytes :: CSize Source #
Size of the fingerprint computed by cryptoShortHashX24
.
See: crypto_shorthash_siphashx24_KEYBYTES
Since: 0.0.1.0