crypto

package
v0.0.1-3-g2e5d Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2018 License: MIT Imports: 11 Imported by: 150

Documentation

Index

Constants

View Source
const (
	SIGNRLEN     = 32
	SIGNATURELEN = 64
	NEGBIGNUMLEN = 33
)
View Source
const (
	INFINITYLEN      = 1
	FLAGLEN          = 1
	XORYVALUELEN     = 32
	COMPRESSEDLEN    = 33
	NOCOMPRESSEDLEN  = 65
	COMPEVENFLAG     = 0x02
	COMPODDFLAG      = 0x03
	NOCOMPRESSEDFLAG = 0x04
	P256PARAMA       = -3
)

Variables

This section is empty.

Functions

func ComputeRoot

func ComputeRoot(hashes []Uint256) (Uint256, error)

input a []uint256, create a MerkleTree & calc the root hash

func DoubleSHA256

func DoubleSHA256(s []Uint256) Uint256

func Verify

func Verify(publicKey PubKey, data []byte, signature []byte) error

Types

type CryptoAlgSet

type CryptoAlgSet struct {
	EccParams elliptic.CurveParams
	Curve     elliptic.Curve
}

type MerkleTree

type MerkleTree struct {
	Depth uint
	Root  *MerkleTreeNode
}

func NewMerkleTree

func NewMerkleTree(hashes []Uint256) (*MerkleTree, error)

use []Uint256 to create a new MerkleTree

type MerkleTreeNode

type MerkleTreeNode struct {
	Hash  Uint256
	Left  *MerkleTreeNode
	Right *MerkleTreeNode
}

func (*MerkleTreeNode) IsLeaf

func (t *MerkleTreeNode) IsLeaf() bool

type PubKey

type PubKey struct {
	X, Y *big.Int
}

func DecodePoint

func DecodePoint(encodeData []byte) (*PubKey, error)

func (*PubKey) Deserialize

func (e *PubKey) Deserialize(r io.Reader) error

func (*PubKey) Serialize

func (e *PubKey) Serialize(w io.Writer) error

Jump to

Keyboard shortcuts

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