Version: v0.0.0-...-5f1ae1a Latest Latest

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

Go to latest
Published: Dec 6, 2018 License: ISC Imports: 11 Imported by: 0




View Source
const (
	ACCOUNT_ZERO = "rrrrrrrrrrrrrrrrrrrrrhoLvTp"
	ACCOUNT_ONE  = "rrrrrrrrrrrrrrrrrrrrBZbvji"
	NaN          = "rrrrrrrrrrrrrrrrrrrn5RM1rHd"
	ROOT         = "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"


This section is empty.


func Base58Decode

func Base58Decode(b, alphabet string) ([]byte, error)

Base58Decode decodes a modified base58 string to a byte slice and checks checksum.

func Base58Encode

func Base58Encode(b []byte, alphabet string) string

Base58Encode encodes a byte slice to a modified base58 string.

func DoubleSha256

func DoubleSha256(b []byte) []byte

func NewECDSAKey

func NewECDSAKey(seed []byte) (*ecdsaKey, error)

If seed is nil, generate a random one

func NewEd25519Key

func NewEd25519Key(seed []byte) (*ed25519key, error)

func Sha256RipeMD160

func Sha256RipeMD160(b []byte) []byte

func Sha512Half

func Sha512Half(b []byte) []byte

Returns first 32 bytes of a SHA512 of the input bytes

func Sha512Quarter

func Sha512Quarter(b []byte) []byte

Returns first 16 bytes of a SHA512 of the input bytes

func Sign

func Sign(privateKey, hash, msg []byte) ([]byte, error)

func Verify

func Verify(publicKey, hash, msg, signature []byte) (bool, error)


type Hash

type Hash interface {
	Version() HashVersion
	Payload() []byte
	PayloadTrimmed() []byte
	Value() *big.Int
	String() string
	Clone() Hash
	MarshalText() ([]byte, error)

func AccountId

func AccountId(key Key, sequence *uint32) (Hash, error)

func AccountPrivateKey

func AccountPrivateKey(key Key, sequence *uint32) (Hash, error)

func AccountPublicKey

func AccountPublicKey(key Key, sequence *uint32) (Hash, error)

func GenerateFamilySeed

func GenerateFamilySeed(password string) (Hash, error)

func NewAccountId

func NewAccountId(b []byte) (Hash, error)

func NewAccountPrivateKey

func NewAccountPrivateKey(b []byte) (Hash, error)

func NewAccountPublicKey

func NewAccountPublicKey(b []byte) (Hash, error)

func NewFamilySeed

func NewFamilySeed(b []byte) (Hash, error)

func NewNodePrivateKey

func NewNodePrivateKey(b []byte) (Hash, error)

func NewNodePublicKey

func NewNodePublicKey(b []byte) (Hash, error)

func NewRippleHash

func NewRippleHash(s string) (Hash, error)

func NewRippleHashCheck

func NewRippleHashCheck(s string, version HashVersion) (Hash, error)

Checks hash matches expected version

func NodePrivateKey

func NodePrivateKey(key Key) (Hash, error)

func NodePublicKey

func NodePublicKey(key Key) (Hash, error)

type HashVersion

type HashVersion byte
const (
	ALPHABET = "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"

	RIPPLE_ACCOUNT_ID      HashVersion = 0
	RIPPLE_NODE_PUBLIC     HashVersion = 28
	RIPPLE_NODE_PRIVATE    HashVersion = 32
	RIPPLE_FAMILY_SEED     HashVersion = 33

type Key

type Key interface {
	Private(*uint32) []byte
	Id(*uint32) []byte
	Public(*uint32) []byte

Jump to

Keyboard shortcuts

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