base58

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: MIT Imports: 2 Imported by: 41 modules, 41 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeToBig

func DecodeToBig(src []byte) (*big.Int, error)

Decode a big integer from the bytes. Returns an error on corrupt input.

Example
n, err := DecodeToBig([]byte("CGy"))
if err != nil {
	fmt.Println("error:", err)
	return
}
fmt.Printf("%d\n", n)
Output:
123456

func EncodeBig

func EncodeBig(dst []byte, src *big.Int) []byte

Encode encodes src, appending to dst. Be sure to use the returned new value of dst.

Example
buf := EncodeBig(nil, big.NewInt(123456))
fmt.Printf("%s\n", buf)
Output:
CGy

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
⌂ 换网址