crypto

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENTROPY_LENGTH      = 16
	ALGORITHM_ED25519   = "ed25519"
	ALGORITHM_SECP256K1 = "secp256k1"
)
View Source
const (
	// ALPHABET is the modified base58 alphabet used by XRPL.
	ALPHABET = "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"
)
View Source
const (
	ED25519_PRIVATE_KEY_PREFIX = 0xED
)
View Source
const (
	SECP256K1_PRIVATE_KEY_PREFIX = 0x00
)

Variables

View Source
var (
	ED25519_SEED_PREFIX = []byte{0x01, 0xe1, 0x4b}
)
View Source
var (
	SECP256K1_SEED_PREFIX = []byte{0x21}
)

Functions

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 DecodeSeed

func DecodeSeed(seed string) (string, []byte, error)

func DeriveKeypair

func DeriveKeypair(seed string) ([]byte, []byte, error)

func DeriveKeypairEd25519

func DeriveKeypairEd25519(entropy []byte) ([]byte, []byte, error)

func DeriveKeypairSecp256k1

func DeriveKeypairSecp256k1(entropy []byte, sequence *uint32) ([]byte, []byte, error)

func DoubleSha256

func DoubleSha256(b []byte) []byte

Returns bytes of a SHA256 double hash of the input bytes

func GenerateEntropy

func GenerateEntropy() ([]byte, error)

func GenerateKeyPair

func GenerateKeyPair(algorithm string) (string, []byte, []byte, error)

func GenerateSeed

func GenerateSeed(algorithm string) (string, error)

func GenerateSeedEd25519

func GenerateSeedEd25519(entropy []byte) (string, error)

func GenerateSeedSecp256k1

func GenerateSeedSecp256k1(entropy []byte) (string, error)

func Sha256RipeMD160

func Sha256RipeMD160(b []byte) []byte

Returns bytes of a SHA256 ripemd160 of the input bytes

func Sha512Half

func Sha512Half(b []byte) []byte

Returns first 32 bytes of a SHA512 of the input bytes

Types

This section is empty.

Jump to

Keyboard shortcuts

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