hash package:cryptonite
Hash a strict bytestring into a digest.
Generalized cryptographic hash interface, that you can use with
cryptographic hash algorithm that belong to the HashAlgorithm type
class.
import Crypto.Hash
sha1 :: ByteString -> Digest SHA1
sha1 = hash
hexSha3_512 :: ByteString -> String
hexSha3_512 bs = show (hash bs :: Digest SHA3_512)
Get the block size of a hash algorithm
Get the digest size of a hash algorithm
Finalize a context and return a digest.
Update the context with the first N bytes of a bytestring and return
the digest. The code path is independent from N but much slower than a
normal
hashUpdate. The function can be called for the last
bytes of a message, in order to exclude a variable padding, without
leaking the padding length. The begining of the message, never
impacted by the padding, should preferably go through
hashUpdate for better performance.
Initialize a new context for this hash algorithm
Initialize a new context for a specified hash algorithm
Hash the first N bytes of a bytestring, with code path independent
from N.
Run the
hashPrefix function but takes an explicit hash
algorithm parameter
run hashUpdates on one single bytestring and return the updated
context.
Update the context with a list of strict bytestring, and return a new
context with the updates.
Run the
hash function but takes an explicit hash algorithm
parameter
Hash a lazy bytestring into a digest.
Get the size of the context used for a hash algorithm
Finalize the context and set the digest raw memory to the right value
Initialize a context pointer to the initial state of a hash algorithm
Update the context with some raw data
Finalize a mutable hash context and compute a digest
Create a new mutable hash context.
the algorithm used is automatically determined from the return
constraint.
Create a new mutable hash context.
The algorithm is explicitely passed as parameter
Reset the mutable context to the initial state of the hash
Update a mutable hash context in place
Create a bcrypt hash for a password with a provided cost value.
Typically used to create a hash when a new user account is registered
or when a user changes their password.
Each increment of the cost approximately doubles the time taken. The
16 bytes of random salt will be generated internally.