Documentation ¶
Index ¶
- Constants
- func AesDecrypt(cipherText []byte, key []byte, iv []byte) ([]byte, error)
- func AesEncrypt(plaintext []byte, key []byte, iv []byte) ([]byte, error)
- func AppendSignature(signerIndex int, signature, data, code, param []byte) ([]byte, error)
- func ComputeParent(left common.Uint256, right common.Uint256) common.Uint256
- func ComputeRoot(hashes []common.Uint256) (common.Uint256, error)
- func Equal(e1 *PublicKey, e2 *PublicKey) bool
- func GetM(code []byte) (uint, error)
- func GetScriptType(script []byte) (byte, error)
- func GetSignStatus(code, param []byte) (haveSign, needSign int, err error)
- func ParseCrossChainScript(code []byte) ([][]byte, error)
- func ParseMultisigScript(code []byte) ([][]byte, error)
- func Sign(priKey []byte, data []byte) ([]byte, error)
- func SortPublicKeys(publicKeys []*PublicKey)
- func ToAesKey(pwd []byte) []byte
- func Verify(publicKey PublicKey, data []byte, signature []byte) error
- type CryptoAlgSet
- type MerkleTree
- type MerkleTreeNode
- type PublicKey
Constants ¶
View Source
const ( PUSH1 = 0x51 // encoded public key length 0x21 || encoded public key (33 bytes) || OP_CHECKSIG(0xac) PublicKeyScriptLength = 35 // signature length(0x40) || 64 bytes signature SignatureScriptLength = 65 // 1byte m || 3 encoded public keys with leading 0x40 (34 bytes * 3) || // 1byte n + 1byte OP_CHECKMULTISIG MinMultiSignCodeLength = 71 )
View Source
const ( SignerLength = 32 SignatureLength = 64 NegativeBigLength = 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 AesDecrypt ¶ added in v0.2.2
func AesEncrypt ¶ added in v0.2.2
func AppendSignature ¶ added in v0.2.2
func ComputeParent ¶ added in v0.2.2
func ComputeRoot ¶
input a []uint256, create a MerkleTree & calc the root hash
func GetScriptType ¶ added in v0.2.2
func GetSignStatus ¶ added in v0.2.2
func ParseCrossChainScript ¶ added in v0.2.2
func ParseMultisigScript ¶ added in v0.2.2
func SortPublicKeys ¶ added in v0.2.2
func SortPublicKeys(publicKeys []*PublicKey)
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 []common.Uint256) (*MerkleTree, error)
use []Uint256 to create a new MerkleTree
type MerkleTreeNode ¶
type MerkleTreeNode struct { Hash common.Uint256 Left *MerkleTreeNode Right *MerkleTreeNode }
func (*MerkleTreeNode) IsLeaf ¶
func (t *MerkleTreeNode) IsLeaf() bool
type PublicKey ¶ added in v0.2.2
func DecodePoint ¶
func GenerateKeyPair ¶ added in v0.2.2
func GenerateSubKeyPair ¶ added in v0.2.2
func (*PublicKey) EncodePoint ¶ added in v0.2.2
Click to show internal directories.
Click to hide internal directories.