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 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 Decrypt(privateKey, cipher []byte) (m []byte, err error)
- func Encrypt(publicKey *PublicKey, message []byte) (ct []byte, err 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 ParseCrossChainScriptV1(code []byte) ([][]byte, int, int, 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 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 // max signature length(0x40) || 1000 signature (64 bytes * 1000) MaxSignatureScriptLength = 64001 // 1byte m || 2 encoded public keys with leading 0x40 (34 bytes * 2) || // 1byte n + 1byte OP_CHECKMULTISIG MinMultiSignCodeLength = 71 // 1byte m || 1000 encoded public keys with leading 0x40 (34 bytes * 1000) || // 1byte n + 1byte OP_CHECKMULTISIG MaxMultiSignCodeLength = 34003 )
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 ¶
View Source
var ( DefaultCurve = elliptic.P256() DefaultParams = DefaultCurve.Params() )
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 ParseCrossChainScriptV1 ¶ added in v0.7.0
func ParseMultisigScript ¶ added in v0.2.2
func SortPublicKeys ¶ added in v0.2.2
func SortPublicKeys(publicKeys []*PublicKey)
Types ¶
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.