base58check

package module
v0.0.0-...-b05365d Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2018 License: MIT Imports: 6 Imported by: 26

README

base58check

Build Status GoDoc Go Report Card

This package in Go provides functions to encode and decode in base58check, a specific base58 encoding format for encoding Bitcoin addresses.

Functions:

func Encode(string, string) (string, error) {} // takes the version and data as hexadecimal strings and returns the encoded string
func Decode(string) (string, error) {} // takes the encoded string and returns the decoded version prepended hexadecimal string
Installation
go get github.com/anaskhan96/base58check
Usage
package main

import (
	"fmt"
	"log"

	"github.com/anaskhan96/base58check"
)

func main() {
	encoded, err := base58check.Encode("80", "44D00F6EB2E5491CD7AB7E7185D81B67A23C4980F62B2ED0914D32B7EB1C5581")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(encoded) // 5JLbJxi9koHHvyFEAERHLYwG7VxYATnf8YdA9fiC6kXMghkYXpk

	decoded, err := base58check.Decode("1mayif3H2JDC62S4N3rLNtBNRAiUUP99k")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(decoded) // 00086eaa677895f92d4a6c5ef740c168932b5e3f44
}

References

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(encoded string) (string, error)

Decode decodes the given base58check encoded string and returns the version prepended decoded string

func Encode

func Encode(version, data string) (string, error)

Encode encodes the given version and data to a base58check encoded string

Types

This section is empty.

Jump to

Keyboard shortcuts

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