Documentation ¶
Index ¶
- Variables
- func AesDecrypt(ciphertext []byte, key []byte, iv []byte) ([]byte, error)
- func AesEncrypt(plaintext []byte, key []byte, iv []byte) ([]byte, error)
- func CheckPrivateKey(privkey []byte) error
- func CheckSeed(seed []byte) error
- func ComputeRoot(hashes []Uint256) (Uint256, error)
- func Equal(e1 *PubKey, e2 *PubKey) bool
- func GenerateVrf(privateKey, data []byte, randSrc bool) ([]byte, []byte, error)
- func GetPrivateKeyFromSeed(seed []byte) []byte
- func GetSeedFromPrivateKey(priKey []byte) []byte
- func PKCS5Padding(src []byte, blockSize int) []byte
- func PKCS5UnPadding(src []byte) []byte
- 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
- func VerifyVrf(publicKey PubKey, data, vrf, proof []byte) bool
- type MerkleTree
- type MerkleTreeNode
- type PubKey
- type PubKeySlice
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DOUBLE_SHA256 = func(s []Uint256) Uint256 { b := new(bytes.Buffer) for _, d := range s { d.Serialize(b) } temp := sha256.Sum256(b.Bytes()) f := sha256.Sum256(temp[:]) return Uint256(f) } )
View Source
var Sha256ZeroHash = make([]byte, 32)
Functions ¶
func CheckPrivateKey ¶
func ComputeRoot ¶
func ComputeRoot(hashes []Uint256) (Uint256, error)
input a []uint256, create a MerkleTree & calc the root hash
func GetPrivateKeyFromSeed ¶
func GetSeedFromPrivateKey ¶
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 PubKey ¶
func DecodePoint ¶
func GenKeyPair ¶
func NewPubKeyFromBytes ¶
func (*PubKey) EncodePoint ¶
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)
Directories ¶
Path | Synopsis |
---|---|
edwards25519
Package edwards25519 implements operations in GF(2**255-19) and on an Edwards curve that is isomorphic to curve25519.
|
Package edwards25519 implements operations in GF(2**255-19) and on an Edwards curve that is isomorphic to curve25519. |
vrf
Package ed25519 implements a verifiable random function using the Edwards form of Curve25519, SHA512 and the Elligator map.
|
Package ed25519 implements a verifiable random function using the Edwards form of Curve25519, SHA512 and the Elligator map. |
Click to show internal directories.
Click to hide internal directories.