numconv

package
v0.0.3-beta.7 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package numconv provides utilities for converting 64-bit integers to/from base32 and base62 encodings. It includes functions for generating random strings in these encodings, making it useful for creating compact, URL-safe identifiers and tokens.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base32ToInt64

func Base32ToInt64(s string) (int64, error)

Base32ToInt64 converts a base32 encoded string back to a 64-bit integer. Returns an error if the string contains invalid base32 characters or cannot be decoded.

func Base62ToInt64

func Base62ToInt64(s string) (int64, error)

Base62ToInt64 converts a base62 encoded string back to a 64-bit integer. Returns an error if the string contains invalid base62 characters or cannot be decoded.

func Int64ToBase32

func Int64ToBase32(n int64) string

Int64ToBase32 converts a 64-bit integer to its base32 string representation. It uses the standard base32 encoding with Crockford's alphabet.

func Int64ToBase62

func Int64ToBase62(n int64) string

Int64ToBase62 converts a 64-bit integer to its base62 string representation. It uses the standard base62 encoding with alphanumeric characters.

func RandomBase32

func RandomBase32(length int) string

RandomBase32 generates a random base32 string of the specified length. Returns an empty string if length is non-positive.

func RandomBase62

func RandomBase62(length int) string

RandomBase62 generates a random base62 string of the specified length. Returns an empty string if length is non-positive.

Types

This section is empty.

Jump to

Keyboard shortcuts

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