Liking cljdoc? Tell your friends :D

kryptos.core


Base64Decodecljprotocol

Decodes base64 text.

Decodes base64 text.

decode-base64clj

(decode-base64 s target)

Decodes standard base64. target is :bytes, :string, or :key. :string decodes as UTF-8; :key builds an HmacSHA256 SecretKeySpec.

Decodes standard base64. `target` is :bytes, :string, or :key.
:string decodes as UTF-8; :key builds an HmacSHA256 SecretKeySpec.

decode-base64-urlclj

(decode-base64-url s)
(decode-base64-url s target)

Decodes URL-safe base64.

The one-arity returns a String for String input and a byte array for byte-array input. target is :bytes, :string, or :key; :string decodes as UTF-8 and :key builds an HmacSHA256 SecretKeySpec.

Decodes URL-safe base64.

The one-arity returns a String for String input and a byte array for
byte-array input. `target` is :bytes, :string, or :key; :string decodes
as UTF-8 and :key builds an HmacSHA256 SecretKeySpec.
sourceraw docstring

Base64Encodecljprotocol

Encodes values as base64 text.

Encodes values as base64 text.

encode-base64clj

(encode-base64 x)

Returns standard base64 with padding.

Returns standard base64 with padding.

encode-base64-urlclj

(encode-base64-url x)

Returns URL-safe base64 with padding.

Returns URL-safe base64 with padding.

encode-base64-url-without-paddingclj

(encode-base64-url-without-padding x)

Returns URL-safe base64 without padding.

Returns URL-safe base64 without padding.

encode-base64-without-paddingclj

(encode-base64-without-padding x)

Returns standard base64 without padding.

Returns standard base64 without padding.
sourceraw docstring

generate-symmetric-keyclj

(generate-symmetric-key)

Generates a new random HmacSHA256 key using the JCA default key size.

Generates a new random HmacSHA256 key using the JCA default key size.
sourceraw docstring

hash-dgstclj

(hash-dgst bytes)
(hash-dgst s algo)

Single arity returns the raw SHA-256 digest, suitable for a PKCE code challenge.

The 2-arity is legacy: it uses the platform default charset, drops leading zero bytes via BigInteger, and pads to only 32 characters, so its output is not fixed-width for SHA-224/SHA-256/etc. Prefer hash-digest-hex for new code.

Single arity returns the raw SHA-256 digest, suitable for a PKCE code challenge.

The 2-arity is legacy: it uses the platform default charset, drops leading zero
bytes via BigInteger, and pads to only 32 characters, so its output is not
fixed-width for SHA-224/SHA-256/etc. Prefer `hash-digest-hex` for new code.
sourceraw docstring

hash-digest-hexclj

(hash-digest-hex bytes)
(hash-digest-hex s algo)

Returns the lowercase hex digest of s using algo (e.g. "SHA-256"), zero-padded to twice the digest length.

The one-arity accepts a byte array and uses SHA-256. The two-arity accepts a String (encoded as UTF-8) or a byte array, with an explicit algorithm.

Returns the lowercase hex digest of `s` using `algo` (e.g. "SHA-256"),
zero-padded to twice the digest length.

The one-arity accepts a byte array and uses SHA-256. The two-arity accepts
a String (encoded as UTF-8) or a byte array, with an explicit algorithm.
sourceraw docstring

Signercljprotocol

Computes HMAC-SHA256 signatures. The key argument may be a String, a javax.crypto.spec.SecretKeySpec, or a byte array.

Computes HMAC-SHA256 signatures. The `key` argument may be a String,
a javax.crypto.spec.SecretKeySpec, or a byte array.

signclj

(sign key data)

Returns the HMAC-SHA256 of data as a lowercase hex string.

Returns the HMAC-SHA256 of `data` as a lowercase hex string.

sign-bytesclj

(sign-bytes key data)

Returns the HMAC-SHA256 of data as a byte array.

Returns the HMAC-SHA256 of `data` as a byte array.
sourceraw docstring

verify-hmacclj

(verify-hmac key data hmac)

Verifies a hex hmac against the HMAC-SHA256 of data under key.

Compares the UTF-8 bytes of both hex strings with MessageDigest/isEqual, so the running time does not depend on where they first differ. Returns true when the values match, false otherwise.

Verifies a hex `hmac` against the HMAC-SHA256 of `data` under `key`.

Compares the UTF-8 bytes of both hex strings with MessageDigest/isEqual,
so the running time does not depend on where they first differ. Returns
true when the values match, false otherwise.
sourceraw docstring

verify-hmac-bytesclj

(verify-hmac-bytes key data hmac)

Verifies a raw hmac against the HMAC-SHA256 of data under key.

hmac may be a byte array or any seqable collection of byte values. Byte arrays and normalized collections are compared in constant time. Non-integers and values outside the signed-byte range never match. Returns true when the values match, false otherwise.

Verifies a raw `hmac` against the HMAC-SHA256 of `data` under `key`.

`hmac` may be a byte array or any seqable collection of byte values.
Byte arrays and normalized collections are compared in constant time.
Non-integers and values outside the signed-byte range never match.
Returns true when the values match, false otherwise.
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