Liking cljdoc? Tell your friends :D

kryptos.helpers


->byte-arrayclj

(->byte-array x)

Coerces x to byte[] for constant-time comparison.

Accepted:

  • nil -> nil
  • byte[] -> unchanged
  • String -> UTF-8 bytes (see string->utf8-bytes)
  • sequential -> byte[] via octet (range-checked); octets 0..255 and signed bytes -128..127 are both accepted

Any other type throws ex-info {:type ::not-bytes :value x}.

Coerces `x` to byte[] for constant-time comparison.

Accepted:
  - nil          -> nil
  - byte[]       -> unchanged
  - String       -> UTF-8 bytes (see string->utf8-bytes)
  - sequential   -> byte[] via octet (range-checked); octets 0..255 and signed
                    bytes -128..127 are both accepted

Any other type throws ex-info {:type ::not-bytes :value x}.
sourceraw docstring

bytes->hexclj

(bytes->hex bs)

Returns the lowercase, zero-padded hex representation of byte array bs (two characters per byte).

Returns the lowercase, zero-padded hex representation of byte array `bs`
(two characters per byte).
sourceraw docstring

string->utf8-bytesclj

(string->utf8-bytes s)

Returns String s encoded as UTF-8 byte[]. The charset is explicit so results do not depend on the platform default.

Returns String `s` encoded as UTF-8 byte[].
The charset is explicit so results do not depend on the platform default.
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