mymath

package
v0.0.0-...-2f776a7 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2011 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddByte

func AddByte(one []byte, two byte) []byte

func Base582Hex

func Base582Hex(b string) []byte

convert base58 to hex bytes

func Big2Hex32

func Big2Hex32(b *big.Int) [32]byte

TODO: check

func Byte2String

func Byte2String(b []byte) string

func ConcatBytes

func ConcatBytes(list ...[]byte) []byte

func DoubleDoubleSHA

func DoubleDoubleSHA(a []byte, b []byte) []byte

TODO: test and add to tests double hash input bytes, double hash their concatanation

func DoubleSHA

func DoubleSHA(b []byte) []byte

TODO: test and add to tests double SHA-256 hashing of a single byte array

func DoubleSHAPair

func DoubleSHAPair(a []byte, b []byte) []byte

TODO: test and add to tests double SHA-256 hash of a concatenation of the two inputs

func DoubleSHAPairRev

func DoubleSHAPairRev(a []byte, b []byte) []byte

TODO: test and add to tests double SHA-256 hash of a concatenation of the reverse of two inputs

func DoubleSHARev

func DoubleSHARev(b []byte) []byte

TODO: test and add to tests reverse double SHA-256 hashing of a single byte array

func GenerateMerkleTree

func GenerateMerkleTree(leafs [][]byte) [][]byte

TODO: test and add to tests

func GenerateMerkleTreeFromString

func GenerateMerkleTreeFromString(leafs []string) []string

TODO: test and add to tests

func Hex2Base58Str

func Hex2Base58Str(val []byte) string

func Hex2Base58String

func Hex2Base58String(val []byte) string

func Hex2Big

func Hex2Big(b []byte) *big.Int

func Hex2Str

func Hex2Str(b []byte) string

func Hex2String

func Hex2String(b []byte) string

func Hex2Uint32

func Hex2Uint32(b []byte) uint32

func Hex2Uint64

func Hex2Uint64(b []byte) uint64

func HexRev2Big

func HexRev2Big(rev []byte) *big.Int

func HexRev2Str

func HexRev2Str(b []byte) string

func HexRev2String

func HexRev2String(b []byte) string

func HexRev2Uint32

func HexRev2Uint32(b []byte) uint32

func HexRev2Uint64

func HexRev2Uint64(b []byte) uint64

func Int2Hex

func Int2Hex(i int) []byte

TODO: test

func Makesecp256k1

func Makesecp256k1()

TODO: test and add to tests

func Randuint64

func Randuint64() []byte

func Randuint64Rev

func Randuint64Rev() []byte

func Rev

func Rev(b []byte) []byte

TODO: use this function to reverse some of the below functions?

func RevTest

func RevTest() bool

func Ripemd

func Ripemd(b []byte) []byte

TODO: test and add to tests RIPEMD-160 operation for bitcoin address hashing

func RipemdRev

func RipemdRev(b []byte) []byte

TODO: test and add to tests reverse RIPEMD-160 hash

func SHARipemd

func SHARipemd(b []byte) []byte

TODO: test and add to tests SHA-256 RIPEMD-160 operation for bitcoin address hashing

func SHARipemdRev

func SHARipemdRev(b []byte) []byte

TODO: test and add to tests reverse SHA-256 RIPEMD-160 hash

func SingleSHA

func SingleSHA(b []byte) []byte

TODO: test and add to tests Single SHA-256 hashing of a single byte array

func SingleSHA1

func SingleSHA1(b []byte) []byte

TODO: test and add to tests Single SHA-1 hashing of a single byte array

func SingleSHA1Rev

func SingleSHA1Rev(b []byte) []byte

Reversed SHA-1 hashing of a single byte array TODO: test and add to tests

func SingleSHARev

func SingleSHARev(b []byte) []byte

TODO: test and add to tests Reversed single SHA-256 hashing of a single byte array

func Str2Hex

func Str2Hex(s string) []byte

func Str2HexRev

func Str2HexRev(s string) []byte

func String2Hex

func String2Hex(s string) []byte

func String2Hex32

func String2Hex32(s string) [32]byte

func String2HexRev

func String2HexRev(s string) []byte

func TestBase58

func TestBase58()

TODO: do and test everything

func TestCompile

func TestCompile() bool

func TestEverything

func TestEverything() bool

TODO: do

func TestEverythingBitmath

func TestEverythingBitmath() bool

func TestGenerateMerkleTree

func TestGenerateMerkleTree() bool

func TestLen

func TestLen() bool

func TestVarInt

func TestVarInt() bool

func TestVarInt2Hex

func TestVarInt2Hex() bool

func TestVarInt2HexRev

func TestVarInt2HexRev() bool

func TestVarStr

func TestVarStr() bool

func Uint162Hex

func Uint162Hex(ui uint16) []byte

func Uint162HexRev

func Uint162HexRev(ui uint16) []byte

func Uint2Hex

func Uint2Hex(ui uint) []byte

TODO: test

func Uint322Hex

func Uint322Hex(ui uint32) []byte

func Uint322HexRev

func Uint322HexRev(ui uint32) []byte

func Uint642Hex

func Uint642Hex(ui uint64) []byte

func Uint642HexRev

func Uint642HexRev(ui uint64) []byte

Types

type Base58

type Base58 string

type to hold the Base58 string

func Big2Base58

func Big2Base58(val *big.Int) Base58

encodes big.Int to base58 string

func Hex2Base58

func Hex2Base58(val []byte) Base58

encodes hex bytes into base58

func Int2Base58

func Int2Base58(val int) Base58

encodes int to base58 string

func Str2Hex58

func Str2Hex58(val string) Base58

func StrHex2Base58

func StrHex2Base58(val string) Base58

func String2Base58

func String2Base58(val string) Base58

func StringHex2Base58

func StringHex2Base58(val string) Base58

encodes string stored hex bytes into base58

func (Base58) Base582Big

func (b Base58) Base582Big() *big.Int

func (Base58) Base582Int

func (b Base58) Base582Int() int

convert base58 to int

func (Base58) BitHex

func (b Base58) BitHex() []byte

convert base58 to hexes used by Bitcoins (keeping the zeroes on the front, 25 bytes long)

func (Base58) ToBig

func (b Base58) ToBig() *big.Int

Convert base58 to big.Int

func (Base58) ToHex

func (b Base58) ToHex() []byte

convert base58 to hex bytes

func (Base58) ToInt

func (b Base58) ToInt() int

convert base58 to int

type VarInt

type VarInt uint64

func DecodeVarInt

func DecodeVarInt(b []byte) VarInt

TODO: test

func DecodeVarIntGiveRest

func DecodeVarIntGiveRest(b []byte) (VarInt, []byte)

TODO: check and add to tests

func (VarInt) Compile

func (vi VarInt) Compile() []byte

func (VarInt) Len

func (vi VarInt) Len() int

type VarStr

type VarStr struct {
	// contains filtered or unexported fields
}

func (*VarStr) Compile

func (vs *VarStr) Compile() []byte

func (*VarStr) Len

func (vs *VarStr) Len() int

func (*VarStr) Read

func (vs *VarStr) Read() string

func (*VarStr) Set

func (vs *VarStr) Set(newString string)

Jump to

Keyboard shortcuts

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