consensushashing

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2024 License: ISC Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockHash

func BlockHash(block *externalapi.DomainBlock) *externalapi.DomainHash

BlockHash returns the given block's hash

func CalculateSignatureHashECDSA

func CalculateSignatureHashECDSA(tx *externalapi.DomainTransaction, inputIndex int, hashType SigHashType,
	reusedValues *SighashReusedValues) (*externalapi.DomainHash, error)

CalculateSignatureHashECDSA will, given a script and hash type calculate the signature hash to be used for signing and verification for ECDSA. This returns error only if one of the provided parameters are consensus-invalid.

func CalculateSignatureHashSchnorr

func CalculateSignatureHashSchnorr(tx *externalapi.DomainTransaction, inputIndex int, hashType SigHashType,
	reusedValues *SighashReusedValues) (*externalapi.DomainHash, error)

CalculateSignatureHashSchnorr will, given a script and hash type calculate the signature hash to be used for signing and verification for Schnorr. This returns error only if one of the provided parameters are consensus-invalid.

func HeaderHash

HeaderHash returns the given header's hash

func TransactionHash

TransactionHash returns the transaction hash.

func TransactionID

TransactionID generates the Hash for the transaction without the signature script and payload field.

func TransactionIDs

TransactionIDs converts the provided slice of DomainTransactions to a corresponding slice of TransactionIDs

Types

type SigHashType

type SigHashType uint8

SigHashType represents hash type bits at the end of a signature.

const (
	SigHashAll          SigHashType = 0b00000001
	SigHashNone         SigHashType = 0b00000010
	SigHashSingle       SigHashType = 0b00000100
	SigHashAnyOneCanPay SigHashType = 0b10000000

	// SigHashMask defines the number of bits of the hash type which is used
	// to identify which outputs are signed.
	SigHashMask = 0b00000111
)

Hash type bits from the end of a signature.

func (SigHashType) IsStandardSigHashType

func (sht SigHashType) IsStandardSigHashType() bool

IsStandardSigHashType returns true if sht represents a standard SigHashType

type SighashReusedValues

type SighashReusedValues struct {
	// contains filtered or unexported fields
}

SighashReusedValues holds all fields used in the calculation of a transaction's sigHash, that are the same for all transaction inputs. Reuse of such values prevents the quadratic hashing problem.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL