API Reference › Crypto › Crypto.hex
method

Crypto.hex

Crypto.hex(s) -> string

Encodes the bytes of s as a lowercase hex string — two characters per byte, so an n-byte input becomes a 2n-character result. It is the same encoding Crypto.sha256 already applies to a digest, exposed on its own so you can render arbitrary bytes (a key id, a small binary token) in a form that is safe to print, log, or embed in text.

Parameters

sthe string whose bytes are encoded

Example

program HexDump {
  entry {
    print(Crypto.hex("abc"))   # 616263
  }
}
← All symbols