Documentation ¶
Index ¶
- Constants
- Variables
- func AesDecrypt(ciphertext []byte, key []byte, iv []byte) ([]byte, error)
- func AesEncrypt(plaintext []byte, key []byte, iv []byte) ([]byte, error)
- func ComputeRoot(hashes []Uint256) (Uint256, error)
- func Equal(e1 *PubKey, e2 *PubKey) bool
- func PKCS5Padding(src []byte, blockSize int) []byte
- func PKCS5UnPadding(src []byte) []byte
- func SetAlg(algChoice string)
- func Sha256(value []byte) []byte
- func Sign(privateKey []byte, data []byte) ([]byte, error)
- func ToAesKey(pwd []byte) []byte
- func Verify(publicKey PubKey, data []byte, signature []byte) error
- type MerkleTree
- type MerkleTreeNode
- type PubKey
- type PubKeySlice
Constants ¶
View Source
const ( INFINITYLEN = 1 FLAGLEN = 1 XORYVALUELEN = 32 COMPRESSEDLEN = 33 NOCOMPRESSEDLEN = 65 COMPEVENFLAG = 0x02 COMPODDFLAG = 0x03 NOCOMPRESSEDFLAG = 0x04 P256PARAMA = -3 )
View Source
const (
P256R1 = 0
)
Variables ¶
View Source
var AlgChoice int
It can be P256R1
Functions ¶
func ComputeRoot ¶
func ComputeRoot(hashes []Uint256) (Uint256, error)
input a []uint256, create a MerkleTree & calc the root hash
func PKCS5Padding ¶
func PKCS5UnPadding ¶
Types ¶
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 PubKeySlice ¶
type PubKeySlice []*PubKey
func (PubKeySlice) Len ¶
func (p PubKeySlice) Len() int
func (PubKeySlice) Less ¶
func (p PubKeySlice) Less(i, j int) bool
func (PubKeySlice) Swap ¶
func (p PubKeySlice) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.