Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- init :: Ptr HasherInternal -> IO ()
- update :: forall bin. ByteArrayAccess bin => Ptr HasherInternal -> [bin] -> IO ()
- finalize :: forall len. KnownNat len => Ptr HasherInternal -> IO (Digest len)
- data Hasher
- allocRetHasher :: forall a. (Ptr HasherInternal -> IO a) -> IO (a, Hasher)
- data Digest (len :: Nat)
- allocRetDigest :: forall len a. KnownNat len => (Ptr Word8 -> IO a) -> IO (a, Digest len)
- data HasherInternal
- copyHasher :: Hasher -> IO Hasher
- withHasherInternal :: Hasher -> (Ptr HasherInternal -> IO a) -> IO a
- data Key
- key :: ByteArrayAccess bin => bin -> Maybe Key
- allocRetKey :: forall a. (Ptr Word8 -> IO a) -> IO (a, Key)
- initKeyed :: Ptr HasherInternal -> Key -> IO ()
- data Context
- context :: ByteArrayAccess bin => bin -> Maybe Context
- initDerive :: Ptr HasherInternal -> Context -> IO ()
- type HASHER_ALIGNMENT = 8
- type HASHER_SIZE = 1912
- type KEY_LEN = 32
- type BLOCK_SIZE = 64
- type DEFAULT_DIGEST_LEN = 32
Hashing
:: ByteArrayAccess bin | |
=> Ptr HasherInternal | Will be mutated. |
-> [bin] | |
-> IO () |
Update HasherInternal
state with new data.
:: KnownNat len | |
=> Ptr HasherInternal | Will be mutated. |
-> IO (Digest len) |
Finalize HasherInternal
state and obtain a digest.
The HasherInternal
is mutated.
Immutable BLAKE3 hashing state.
Obtain with hasher
or hasherKeyed
.
:: (Ptr HasherInternal -> IO a) | Initialize |
-> IO (a, Hasher) |
data Digest (len :: Nat) Source #
Output from BLAKE3 algorithm, of len
bytes.
The default digest length for BLAKE3 is DEFAULT_DIGEST_LEN
.
Memory
data HasherInternal Source #
Opaque datatype of size HASHER_SIZE
and alignment HASHER_ALIGNMENT
.
Obtain with withHasherInternal
.
Keyed hashing
:: ByteArrayAccess bin | |
=> bin | Key bytes. Must have length |
-> Maybe Key |
:: Ptr HasherInternal | Will be mutated. |
-> Key | |
-> IO () |
Initialize a HasherInternal
in keyed mode.
Key derivation
Context for BLAKE3 key derivation. Obtain with context
.
:: ByteArrayAccess bin | |
=> bin | If |
-> Maybe Context |
Obtain a Context
for BLAKE3 key derivation.
The context should be hardcoded, globally unique, and application-specific.
A good format for the context string is:
[application] [commit timestamp] [purpose]
For example:
example.com 2019-12-25 16:18:03 session tokens v1
:: Ptr HasherInternal | Will be mutated. |
-> Context | |
-> IO () |
Initialize a HasherInternal
in derivation mode.
The input key material must be provided afterwards, using update
.
Constants
type HASHER_ALIGNMENT = 8 Source #
type HASHER_SIZE = 1912 Source #
In bytes.
type BLOCK_SIZE = 64 Source #
In bytes.
type DEFAULT_DIGEST_LEN = 32 Source #
In bytes.