Oslo

decodeHex()

Decodes hex-encoded strings based on RFC 4648 ยง8. Supports both lowercase and uppercase hex strings anf throws if the hex string is malformed. Use encodeHex() to encode into hex strings.

Definition

function decodeHex(data: string): Uint8Array;

Parameters

  • data

Example

import { decodeHex } from "oslo/encoding";

const data = decodeHex(encoded);
const text = new TextDecoder().decode(data);