crypto

package
v0.0.4-ea46d2c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2018 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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