Liking cljdoc? Tell your friends :D

toolnexus.mcp-crypto


b64-std-decodeclj/s

(b64-std-decode s)

Standard base64 (RFC 4648 §4, padded) -> string, or nil when malformed.

Standard base64 (RFC 4648 §4, padded) -> string, or nil when malformed.
sourceraw docstring

b64urlclj/s

(b64url x)

base64url without padding (RFC 4648 §5) of byte values or a string.

base64url without padding (RFC 4648 §5) of byte values or a string.
sourceraw docstring

b64url-decode-valsclj/s

(b64url-decode-vals s)

base64url (padding optional) -> unsigned byte values. Throws on a character outside the alphabet.

base64url (padding optional) -> unsigned byte values. Throws on a character
outside the alphabet.
sourceraw docstring

form-encodeclj/s

(form-encode m)

application/x-www-form-urlencoded of a map, keys sorted (deterministic).

application/x-www-form-urlencoded of a map, keys sorted (deterministic).
sourceraw docstring

hexclj/s

(hex vs)

Lower-case hex of unsigned byte values.

Lower-case hex of unsigned byte values.
sourceraw docstring

int->valsclj/s

(int->vals n)
(int->vals n len)

A non-negative integer -> big-endian unsigned byte values, left-padded to len (minimal length when len is nil).

A non-negative integer -> big-endian unsigned byte values, left-padded to
`len` (minimal length when `len` is nil).
sourceraw docstring

jwk->publicclj/s

(jwk->public jwk)

A JWK's {"n" "e"} (base64url) -> {:n :e}.

A JWK's {"n" "e"} (base64url) -> {:n :e}.
sourceraw docstring

mod-powclj/s

(mod-pow base e m)

base^e mod m (square-and-multiply, left to right).

base^e mod m (square-and-multiply, left to right).
sourceraw docstring

parse-queryclj/s

(parse-query q)

A query / form string as {name first-value}. Malformed escapes keep the raw text.

A query / form string as {name first-value}. Malformed escapes keep the raw text.
sourceraw docstring

probable-prime?clj/s

(probable-prime? n rounds)

Trial division by the primes below 2000, then rounds Miller-Rabin rounds.

Trial division by the primes below 2000, then `rounds` Miller-Rabin rounds.
sourceraw docstring

rand-tokenclj/s

(rand-token n)

n random url-safe characters (hex) from the host CSPRNG.

n random url-safe characters (hex) from the host CSPRNG.
sourceraw docstring

rsa-generateclj/s

(rsa-generate)
(rsa-generate bits)

A fresh RSA key pair: {:n :e :d :p :q :dp :dq :qinv}. bits default 2048.

A fresh RSA key pair: {:n :e :d :p :q :dp :dq :qinv}. `bits` default 2048.
sourceraw docstring

rsa-jwkclj/s

(rsa-jwk {:keys [n e]})

The public JWK members {"kty" "n" "e"} of a key.

The public JWK members {"kty" "n" "e"} of a key.
sourceraw docstring

rsa-signclj/s

(rsa-sign {:keys [n p q dp dq qinv]} msg)

RS256 (RSASSA-PKCS1-v1_5 + SHA-256) of string msg; signature byte values. NOT constant-time — dev/test keys only (see the namespace comment).

RS256 (RSASSA-PKCS1-v1_5 + SHA-256) of string `msg`; signature byte values.
NOT constant-time — dev/test keys only (see the namespace comment).
sourceraw docstring

rsa-verify?clj/s

(rsa-verify? {:keys [n e]} msg sig)

True when sig (byte values) is a valid RS256 signature of string msg under the public key {:n :e}.

True when `sig` (byte values) is a valid RS256 signature of string `msg`
under the public key {:n :e}.
sourceraw docstring

sha256clj/s

(sha256 x)

SHA-256 of a string (UTF-8) or a seq of unsigned byte values; 32 unsigned byte values.

SHA-256 of a string (UTF-8) or a seq of unsigned byte values; 32 unsigned
byte values.
sourceraw docstring

url-decodeclj/s

(url-decode s)
(url-decode s plus?)

Percent-decode ONCE; plus? also maps + to a space (forms). Throws on a malformed escape or a result that is not UTF-8.

Percent-decode ONCE; `plus?` also maps `+` to a space (forms). Throws on a
malformed escape or a result that is not UTF-8.
sourceraw docstring

url-encodeclj/s

(url-encode s)

Percent-encode every byte outside RFC 3986's unreserved set (UTF-8).

Percent-encode every byte outside RFC 3986's unreserved set (UTF-8).
sourceraw docstring

utf8-valsclj/s

(utf8-vals s)

A string's UTF-8 bytes as unsigned values (0-255).

A string's UTF-8 bytes as unsigned values (0-255).
sourceraw docstring

valid-utf8?clj/s

(valid-utf8? vs)

True when the unsigned byte values are well-formed UTF-8 (RFC 3629: no overlongs, no surrogates, nothing above U+10FFFF).

True when the unsigned byte values are well-formed UTF-8 (RFC 3629: no
overlongs, no surrogates, nothing above U+10FFFF).
sourceraw docstring

vals->intclj/s

(vals->int vs)

Big-endian unsigned byte values -> a non-negative integer.

Big-endian unsigned byte values -> a non-negative integer.
sourceraw docstring

vals->utf8clj/s

(vals->utf8 vs)

Unsigned byte values back to a string (UTF-8).

Unsigned byte values back to a string (UTF-8).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close