crockford

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package crockford provides Crockford Base32 encoding and decoding for int64 values. It uses the Crockford alphabet which excludes I, L, O, U to avoid ambiguity. Decoding is case-insensitive.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalid = errors.New("usid: invalid crockford character")

ErrInvalid is returned when decoding a string with invalid characters.

Functions

func Decode

func Decode(s string) (int64, error)

Decode parses a Crockford Base32-encoded string and returns the int64 value. Decoding is case-insensitive. I and L are treated as 1, O is treated as 0. Returns ErrInvalid if the string contains invalid characters.

func Encode

func Encode(id int64) string

Encode returns the Crockford Base32 encoding of the given int64.

Types

This section is empty.

Jump to

Keyboard shortcuts

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