base58

package module
v0.0.0-...-5e83fd6 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2015 License: MIT Imports: 2 Imported by: 7

README

Base58 encoding for Go

Base58 is a less known encoding, but it is popular when embedding resource identifiers into URLs.

The encoded data contains only alphanumericals, and avoids the easily confused characters 0, i, l and O (zero, india, lima, capital oscar).

The API docs for this package are online at http://godoc.org/github.com/tv42/base58

Documentation

Overview

Package base58 implements a human-friendly base58 encoding.

As opposed to base64 and friends, base58 is typically used to convert integers. You can use big.Int.SetBytes to convert arbitrary bytes to an integer first, and big.Int.Bytes the other way around.

Index

Constants

This section is empty.

Variables

View Source
var DecodeToBig func([]byte) (*big.Int, error) = DefaultEncoding.DecodeToBig

Decode a big integer from the bytes. Returns an error on corrupt input. This is a shortcut to DefaultEncoding.DecodeToBig. It's suggested for maintainability reasons to use the full reference in new code.

View Source
var DefaultEncoding = NewEncoder(caps_last_alphabet)

Uses alphabet "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" Default for compatibility reasons. The "EncodeBig" and "DecodeToBig" top-level functions are just shortcuts for methods on this encoding.

View Source
var EncodeBig func([]byte, *big.Int) []byte = DefaultEncoding.EncodeBig

Encode encodes src, appending to dst. Be sure to use the returned new value of dst. This is a shortcut to DefaultEncoding.EncodeBig. It's suggested for maintainability reasons to use the full reference in new code.

View Source
var StdEncoding = NewEncoder(caps_first_alphabet)

Uses alphabet "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" Standard because it appears to be in wider use, v/v miniLock, Bitcoin, Python's base58, etc.

Functions

func NewEncoder

func NewEncoder(alphabet string) *encodingAlphabet

If a custom alphabet is desired it can be defined here by passing a length 62 string of unique characters. Two encodings are provided in this library already, representing "caps first" or "caps last" base58.

Types

type CorruptInputError

type CorruptInputError int64

func (CorruptInputError) Error

func (e CorruptInputError) Error() string

Directories

Path Synopsis
cmd
base58-decode command
base58-encode command

Jump to

Keyboard shortcuts

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