package
0.26.1
Repository: https://github.com/ness-network/ness3.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
Package bip32 implements the bip32 spec https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki */.
Package bip39 is the Golang implementation of the BIP39 spec.
Package chacha20poly1305 implements the ChaCha20-Poly1305 AEAD as specified in RFC 7539.
Package encoder binary implements translation between struct data and byte sequences Fields can be ignored with the struct tag `enc:"-"` .
Package encrypt provides encryption methods.
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0.
Package poly1305 implements Poly1305 one-time message authentication code as specified in http://cr.yp.to/mac/poly1305-20050329.pdf.
Package ripemd160 implements the RIPEMD-160 hash algorithm.
Package scrypt implements the scrypt key derivation function as defined in Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard Functions" (http://www.tarsnap.com/scrypt/scrypt.pdf).
Package secp256k1 provides private and public key generation with the secp256k1 elliptic curve.
Package testsuite is the cipher testdata testsuite */.

# Functions

AddressFromBytes converts []byte to an Address.
AddressFromPubKey creates Address from PubKey as ripemd160(sha256(sha256(pubkey))).
AddressFromSecKey generates address from secret key.
AddSHA256 returns the SHA256 hash of to two concatenated hashes.
BitcoinAddressFromBytes converts []byte to a BitcoinAddress.
BitcoinAddressFromPubKey creates a mainnet (version 0) BitcoinAddress from PubKey as ripemd160(sha256(pubkey))).
BitcoinAddressFromSecKey generates a BitcoinAddress from SecKey.
BitcoinPubKeyRipemd160 returns ripemd160(sha256(key)).
BitcoinWalletImportFormatFromSeckey exports seckey in wallet import format key must be compressed.
CheckSecKey test seckey hash.
CheckSecKeyHash performs a series of tests to determine if a seckey is valid.
DecodeBase58Address creates an Address from its base58 encoding.
DecodeBase58BitcoinAddress creates a BitcoinAddress from its base58 encoding.
DeterministicKeyPairIterator takes SHA256 value, returns a new SHA256 value and publickey and private key.
DoubleSHA256 double SHA256.
ECDH generates a shared secret A: pub1,sec1 B: pub2,sec2 person A sends their public key pub1 person B sends an emphameral pubkey pub2 person A computes cipher.ECDH(pub2, sec1) person B computes cipher.ECDH(pub1, sec2) cipher.ECDH(pub2, sec1) equals cipher.ECDH(pub1, sec2) This is their shared secret.
GenerateDeterministicKeyPair generates deterministic key pair.
GenerateDeterministicKeyPairs returns sequence of n private keys from initial seed.
GenerateDeterministicKeyPairsSeed returns sequence of n private keys from initial seed, and return the new seed.
GenerateKeyPair creates key pair.
HashRipemd160 hash data to Ripemd160.
Merkle computes the merkle root of a hash array Array of hashes is padded with 0 hashes until next power of 2.
MustAddressFromBytes converts []byte to an Address, panics on error.
MustAddressFromSecKey generates address from secret key, panics on error.
MustBitcoinAddressFromBytes converts []byte to a BitcoinAddress, panics on error.
MustBitcoinAddressFromSecKey generates a BitcoinAddress from SecKey, panics on error.
MustDecodeBase58Address creates an Address from its base58 encoding, panics on error.
MustDecodeBase58BitcoinAddress creates a BitcoinAddress from its base58 encoding, panics on error.
MustDeterministicKeyPairIterator takes SHA256 value, returns a new SHA256 value and publickey and private key.
MustECDH calls ECDH and panics on error.
MustGenerateDeterministicKeyPair generates deterministic key pair, panics on error.
MustGenerateDeterministicKeyPairs returns sequence of n private keys from initial seed, panics on error.
MustGenerateDeterministicKeyPairsSeed returns sequence of n private keys from initial seed, and return the new seed.
MustNewPubKey converts []byte to a PubKey, panics on error.
MustNewSecKey converts []byte to a SecKey.
MustNewSig converts []byte to a Sig.
MustPubKeyFromHex decodes a hex encoded PubKey, panics on error.
MustPubKeyFromSecKey recovers the public key for a secret key.
MustPubKeyFromSig recovers the public key from a signed hash, panics on error.
MustRipemd160FromBytes converts []byte to Ripemd160, panics on error.
MustSecKeyFromBitcoinWalletImportFormat extracts a seckey from the bitcoin wallet import format, panics on error.
MustSecKeyFromHex decodes a hex encoded SecKey, or panics.
MustSHA256FromBytes converts []byte to SHA256, panics on error.
MustSHA256FromHex decodes a hex encoded SHA256 hash to bytes, panics on error.
MustSigFromHex converts a hex string to a signature, panics on error.
MustSignHash sign hash, panics on error.
NewPubKey converts []byte to a PubKey.
NewSecKey converts []byte to a SecKey.
NewSig converts []byte to a Sig.
PubKeyFromHex generates PubKey from hex string.
PubKeyFromSecKey recovers the public key for a secret key.
PubKeyFromSig recovers the public key from a signed hash.
PubKeyRipemd160 returns ripemd160(sha256(sha256(pubkey))).
RandByte returns rand N bytes.
Ripemd160FromBytes converts []byte to Ripemd160.
SecKeyFromBitcoinWalletImportFormat extracts a seckey from the bitcoin wallet import format.
SecKeyFromHex decodes a hex encoded SecKey, or panics.
SHA256FromBytes converts []byte to SHA256.
SHA256FromHex decodes a hex encoded SHA256 hash to bytes.
SigFromHex converts a hex string to a signature.
SignHash sign hash.
SumSHA256 sum sha256.
VerifyAddressSignedHash checks whether PubKey corresponding to address hash signed hash - recovers the PubKey from sig and hash - fail if PubKey cannot be be recovered - computes the address from the PubKey - fail if recovered address does not match PubKey hash - verify that signature is valid for hash for PubKey.
VerifyPubKeySignedHash verifies that hash was signed by PubKey.
VerifySignatureRecoverPubKey this only checks that the signature can be converted to a public key.

# Variables

checks for extremely unlikely conditions (10e-40).
enable checks for impossible conditions.
ErrAddressInvalidChecksum Computed checksum did not match expected value.
ErrAddressInvalidFirstByte Invalid first byte in wallet import format string.
ErrAddressInvalidLastByte 33rd byte in wallet import format string is invalid.
ErrAddressInvalidLength Unexpected size of address bytes buffer.
ErrAddressInvalidPubKey Public key invalid for address.
ErrAddressInvalidVersion Unsupported address version value.
ErrBitcoinWIFInvalidChecksum Invalid Checksum in Bitcoin WIF address.
ErrBitcoinWIFInvalidFirstByte Unexpected value (!= 0x80) of first byte in Bitcoin Wallet Import Format.
ErrBitcoinWIFInvalidSuffix Unexpected value (!= 0x01) of 33rd byte in Bitcoin Wallet Import Format.
ErrECHDInvalidPubKey ECDH invalid pubkey input.
ErrECHDInvalidSecKey ECDH invalid seckey input.
ErrEmptySeed Seed input is empty.
ErrInvalidAddressForSig the address derived from the pubkey recovered from the signature does not match a provided address.
ErrInvalidBytesLength Invalid bytes length.
ErrInvalidDerivedPubKeyFromSecKey impossible error, TestSecKey, Derived Pubkey verification failed.
ErrInvalidHashForSig Signature invalid for hash.
ErrInvalidHexLength Invalid hex length.
ErrInvalidLength Unexpected size of string or bytes buffer.
ErrInvalidLengthPubKey Invalid public key length.
ErrInvalidLengthRipemd160 Invalid ripemd160 length.
ErrInvalidLengthSecKey Invalid secret key length.
ErrInvalidLengthSHA256 Invalid sha256 length.
ErrInvalidLengthSig Invalid signature length.
ErrInvalidPubKey Invalid public key.
ErrInvalidPubKeyFromHash Recovered pubkey does not match signed hash.
ErrInvalidSecKey Invalid public key.
ErrInvalidSecKyVerification Seckey secp256k1 verification failed.
ErrInvalidSig Invalid signature.
ErrInvalidSigForMessage Invalid signature for this message.
ErrInvalidSigInvalidPubKey VerifySignatureRecoverPubKey, secp256k1.VerifyPubkey failed.
ErrInvalidSigPubKeyRecovery could not recover pubkey from sig.
ErrInvalidSigValidity VerifySignatureRecoverPubKey, VerifySignatureValidity failed.
ErrNullPubKeyFromSecKey Impossible error, TestSecKey, nil pubkey recovered.
ErrPubKeyFromBadSecKey PubKeyFromSecKey, pubkey recovery failed.
ErrPubKeyFromNullSecKey Attempt to load null seckey, unsafe.
ErrPubKeyFromSecKeyMismatch impossible error TestSecKey, pubkey does not match recovered pubkey.
ErrPubKeyRecoverMismatch Recovered pubkey does not match pubkey.

# Structs

Address version is after Key to enable better vanity address generation Address struct is a 25 byte with a 20 byte public key hash, 1 byte address type and 4 byte checksum.
BitcoinAddress is a bitcoin address.

# Interfaces

Addresser defines an interface for cryptocurrency addresses.

# Type aliases

Checksum 4 bytes.
PubKey public key.
Ripemd160 ripemd160.
SecKey secret key.
SHA256 32 bytes.
Sig signature.