IF Commons GitHub

hex

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0001-formats FR-013

Hexadecimal text: bytes as lower-case hexadecimal, two digits each, and hexadecimal text as bytes (commons 0001-crypto FR-001). Taken from sha256.ts, which every digest is written through, so that a format of bytes is in the library of formats and the digests depend on it.

import { fromHex, toHex } from "./hex.ts";
toHex(new Uint8Array([1, 255])); // "01ff"
fromHex("01ff"); // Uint8Array [1, 255]

Source: commons/formats/src/hex.ts

2 of 2 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

fromHexfunction
function fromHex(text: string): Uint8Array<ArrayBufferLike> | undefined

Hexadecimal text as bytes, or undefined where it is not an even number of hexadecimal digits.

Imported by 13 tests of the run (13 passed, 0 failed): the library's results

toHexfunction
function toHex(bytes: Uint8Array<ArrayBufferLike>): string

Bytes as lower-case hexadecimal, two digits each.

Imported by 13 tests of the run (13 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.