Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Hexadecimal

Hexadecimal text for digests.

Source: runtime/digest/hex.pep

to_hex

to_hex(bytes: u8[]): String

Returns bytes as lowercase hexadecimal text, two digits per byte, the way checksums and git object ids are usually written.

Parameters

  • bytes — the bytes to write, such as a digest from finish

Returns

  • a String of 2 * bytes.count characters from 0-9a-f

Example

import digest;

assert(digest.to_hex([0, 15, 255]) == "000fff", "two digits per byte");