Module /crypto #
Cryptographic hashing (sha256), HMAC authentication (hmac-sha256), CSPRNG token generation, and constant-time comparison.
(use /crypto)
hash-password #
(hash-password ...)
Exported function in /crypto.
hmac-sha256 #
(crypto/hmac-sha256 key data) -> String
Computes HMAC-SHA256 signature using secret key and payload, returning hex string.
(crypto/hmac-sha256 "secret-key" "message")
random-bytes #
(crypto/random-bytes count) -> Slab
Generates cryptographically secure random bytes as a Slab buffer.
(let key (crypto/random-bytes 32))
random-hex #
(crypto/random-hex count) -> String
Generates a cryptographically secure random hex string of 2 * count characters.
(let hex-token (crypto/random-hex 16))
random-urlsafe #
(crypto/random-urlsafe [count]) -> String
Generates a cryptographically secure URL-safe base64 string without padding.
(let token (crypto/random-urlsafe 32))
sha256 #
(crypto/sha256 data) -> String
Computes SHA-256 digest of String or Slab, returning a 64-character lowercase hexadecimal string.
(crypto/sha256 "hello world")
timing-safe-eq? #
(crypto/timing-safe-eq? a b) -> Bool
Constant-time comparison between two Strings or Slabs to protect against timing attacks.
(if (crypto/timing-safe-eq? user-sig expected-sig) ...)
verify-password #
(verify-password ...)
Exported function in /crypto.
Module /hash #
Fast non-cryptographic hash algorithms: AHash, FNV-1a, SipHash-1-3, and XXHash64.
(use /hash)
a-hash #
(a-hash value) -> Int
Computes a fast 64-bit AHash digest of value.
fnv-1a #
(fnv-1a value) -> Int
Computes a 64-bit FNV-1a non-cryptographic hash of value.
sip-hash-1-3 #
(sip-hash-1-3 value) -> Int
Computes a 64-bit SipHash-1-3 digest of value.
xx-hash-64 #
(xx-hash-64 value) -> Int
Computes a 64-bit XXHash64 digest of value.
Module /jwt #
JSON Web Token (JWT) signing and verification using HMAC-SHA256 (HS256).
(use /jwt)
sign-jwt #
(sign-jwt claims secret) -> String
Signs a claims Map as an HS256 JSON Web Token using secret.
verify-jwt #
(verify-jwt token secret) -> (Result Map Error)
Verifies an HS256 JSON Web Token signature and expiration, returning the decoded claims Map.
Module /uuid #
RFC 9562 UUIDv4 (random) and UUIDv7 (time-ordered) generation and validation.
(use /uuid)
UUIDv4/str #
(UUIDv4/str ...)
Exported function in /uuid.
UUIDv7/str #
(UUIDv7/str ...)
Exported function in /uuid.
construct-v4-str #
(construct-v4-str ...)
Exported function in /uuid.
construct-v7-str #
(construct-v7-str ...)
Exported function in /uuid.
is-valid? #
(is-valid? value) -> Bool
Returns true if the value conforms to the expected format or schema.
make-v4-uuid #
(make-v4-uuid ...)
Exported function in /uuid.