Hashes, HMACs and HKDF, synchronous on every platform.
A hash is :sha-1, :sha-256, :sha-384 or :sha-512 (FIPS 180-4). They come from the JCA on the JVM and from the Closure Library in JavaScript, since WebCrypto only returns promises. For the same results as promises, which WebCrypto computes faster on large data, use digest, sign and derive-bits of the root namespace.
An error is an ex-info whose :type is one of the keywords of the root namespace: not-supported-error for another hash, type-error for an argument that isn't bytes, and operation-error for an HKDF longer than it can be.
Hashes, HMACs and HKDF, synchronous on every platform. A hash is :sha-1, :sha-256, :sha-384 or :sha-512 (FIPS 180-4). They come from the JCA on the JVM and from the Closure Library in JavaScript, since WebCrypto only returns promises. For the same results as promises, which WebCrypto computes faster on large data, use digest, sign and derive-bits of the root namespace. An error is an ex-info whose :type is one of the keywords of the root namespace: not-supported-error for another hash, type-error for an argument that isn't bytes, and operation-error for an HKDF longer than it can be.
(digest hash data)The digest of the bytes data by the hash, as bytes.
The digest of the bytes `data` by the `hash`, as bytes.
(hkdf hash ikm salt info length)The length bytes of output keying material that HKDF derives from the
input keying material ikm, the salt and the info by the hash. A
nil salt or info is empty.
(hkdf :sha-256 ikm salt (bytes/encode "context") 32)
The `length` bytes of output keying material that HKDF derives from the
input keying material `ikm`, the `salt` and the `info` by the `hash`. A
nil salt or info is empty.
(hkdf :sha-256 ikm salt (bytes/encode "context") 32)(hkdf-expand hash prk info length)The length bytes of output keying material that HKDF expands from the
pseudorandom key prk and the info by the hash. A nil info is
empty. The length is at most 255 times the size of the hash's digest.
The `length` bytes of output keying material that HKDF expands from the pseudorandom key `prk` and the `info` by the `hash`. A nil info is empty. The length is at most 255 times the size of the hash's digest.
(hkdf-extract hash salt ikm)The pseudorandom key that HKDF extracts from the input keying material
ikm with the salt by the hash, as bytes. A nil salt is a hash's
length of zeros, as is an empty one.
The pseudorandom key that HKDF extracts from the input keying material `ikm` with the `salt` by the `hash`, as bytes. A nil salt is a hash's length of zeros, as is an empty one.
(hmac hash key data)The HMAC of the bytes data under the bytes key by the hash, as
bytes. The key can be empty, as RFC 2104 allows.
The HMAC of the bytes `data` under the bytes `key` by the `hash`, as bytes. The key can be empty, as RFC 2104 allows.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |