crockford

package
v1.0.0-dev.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package crockford is Douglas Crockford's base32 (https://www.crockford.com/base32.html): the symbols 0-9 and A-Z without I, L, O and U, five bits each, most significant bit first. It has no check symbol; a caller that wants one carries its own.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(s string) (b []byte, ok bool)

Decode returns the bytes s encodes, accepting only what Encode returns: encode symbols alone, no symbol beyond the bytes' last bit, and zero padding bits, so Encode(Decode(s)) == s whenever ok. Run Normalize first for typed input.

func Encode

func Encode(b []byte) string

Encode returns b in encode symbols, most significant bit first, the last symbol padded with zero bits.

func Normalize

func Normalize(s string) string

Normalize applies Crockford's decode reading to typed input: it removes ASCII '-' and space, folds ASCII a-z to upper case, and maps O and o to 0 and I, i, L and l to 1. Every other rune is kept as it is, so a value holding one never decodes. It folds byte by byte, never with Unicode case mapping, which would turn 'ı' and 'ſ' into ASCII letters and so disagree with a client that folds ASCII alone.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL