Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/encoding/hex.ts

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
import * as mod from "https://deno.land/std@0.81.0/encoding/hex.ts";

Functions

Decode decodes src into decodedLen(src.length) bytes If the input is malformed an error will be thrown the error.

DecodedLen returns the length of decoding x source bytes. Specifically, it returns x / 2.

DecodeString returns the bytes represented by the hexadecimal string s. DecodeString expects that src contains only hexadecimal characters and that src has even length. If the input is malformed, DecodeString will throw an error.

Encode encodes src into encodedLen(src.length) bytes.

EncodedLen returns the length of an encoding of n source bytes. Specifically, it returns n * 2.

EncodeToString returns the hexadecimal encoding of src.

ErrInvalidByte takes an invalid byte and returns an Error.

ErrLength returns an error about odd string length.