utils

package
v0.0.0-...-8d1acea Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base58Decode

func Base58Decode(input []byte) []byte

Base58Decode decodes Base58-encoded data

func Base58Encode

func Base58Encode(input []byte) []byte

Base58Encode encodes a byte array to Base58

func CheckDB

func CheckDB(nodeId string) bool

func Checksum

func Checksum(payload []byte) []byte

Checksum generates a checksum for a public key

func CreateDB

func CreateDB(nodeId string)

func GetDBPath

func GetDBPath(nodeId string) string

func HashPubKey

func HashPubKey(pubKey []byte) []byte

HashPubKey hashes public key

func IntToHex

func IntToHex(num int64) []byte

func NewKeyPair

func NewKeyPair() (ecdsa.PrivateKey, []byte)

NewKeyPair generates private & public key

func ReverseBytes

func ReverseBytes(data []byte)

ReverseBytes reverses a byte array

func ValidateAddress

func ValidateAddress(address string) bool

ValidateAddress check if address if valid

Types

type MerkleNode

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

MerkleNode represent a Merkle tree node

func NewMerkleNode

func NewMerkleNode(left, right *MerkleNode, data []byte) *MerkleNode

NewMerkleNode creates a new Merkle tree node

func (*MerkleNode) Data

func (mNode *MerkleNode) Data() []byte

func (*MerkleNode) Left

func (mNode *MerkleNode) Left() *MerkleNode

func (*MerkleNode) Right

func (mNode *MerkleNode) Right() *MerkleNode

type MerkleTree

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

MerkleTree represent a Merkle tree

func NewMerkleTree

func NewMerkleTree(data [][]byte) *MerkleTree

NewMerkleTree creates a new Merkle tree from a sequence of data

func (*MerkleTree) RootNode

func (mt *MerkleTree) RootNode() *MerkleNode

Jump to

Keyboard shortcuts

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