Documentation ¶
Index ¶
Constants ¶
const ( MerkleSignatureSchemeRootSize = stateproofcrypto.SumhashDigestSize // CryptoPrimitivesID is an identification that the Merkle Signature Scheme uses a subset sum hash function // and a falcon signature scheme. CryptoPrimitivesID = uint16(0) )
HashType/ hashSize relate to the type of hash this package uses.
const KeysInMSS stateproofcrypto.HashID = "KP"
Variables ¶
var ( ErrKeyLifetimeIsZero = errors.New("received zero KeyLifetime") ErrSignatureSchemeVerificationFailed = errors.New("merkle signature verification failed") ErrSignatureSaltVersionMismatch = errors.New("the signature's salt version does not match") )
Errors for the merkle signature scheme
Functions ¶
This section is empty.
Types ¶
type Commitment ¶
type Commitment [MerkleSignatureSchemeRootSize]byte
Commitment represents the root of the vector commitment tree built upon the MSS keys.
type CommittablePublicKey ¶
type CommittablePublicKey struct { VerifyingKey stateproofcrypto.FalconVerifier Round uint64 }
CommittablePublicKey is used to create a binary representation of public keys in the merkle signature scheme.
func (*CommittablePublicKey) ToBeHashed ¶
func (e *CommittablePublicKey) ToBeHashed() (stateproofcrypto.HashID, []byte)
ToBeHashed returns the sequence of bytes that would be used as an input for the hash function when creating a merkle tree. In order to create a more SNARK-friendly commitment we must avoid using the msgpack infrastructure. msgpack creates a compressed representation of the struct which might be varied in length, this will be bad for creating SNARK
type Signature ¶
type Signature struct { Signature stateproofcrypto.FalconSignature `codec:"sig"` VectorCommitmentIndex uint64 `codec:"idx"` Proof merklearray.SingleLeafProof `codec:"prf"` VerifyingKey stateproofcrypto.FalconVerifier `codec:"vkey"` // contains filtered or unexported fields }
Signature represents a signature in the merkle signature scheme using falcon signatures as an underlying crypto scheme. It consists of an ephemeral public key, a signature, a merkle verification path and an index. The merkle signature considered valid only if the Signature is verified under the ephemeral public key and the Merkle verification path verifies that the ephemeral public key is located at the given index of the tree (for the root given in the long-term public key). More details can be found on Algorand's spec
func (*Signature) GetFixedLengthHashableRepresentation ¶
GetFixedLengthHashableRepresentation returns the signature as a hashable byte sequence. the format details can be found in the Algorand's spec.
func (*Signature) ValidateSaltVersion ¶
ValidateSaltVersion validates that the version of the signature is matching the expected version
type Verifier ¶
type Verifier struct { Commitment Commitment `codec:"cmt"` KeyLifetime uint64 `codec:"lf"` // contains filtered or unexported fields }
Verifier is used to verify a merklesignature.Signature produced by merklesignature.Secrets.
func (*Verifier) FirstRoundInKeyLifetime ¶
FirstRoundInKeyLifetime calculates the round of the valid key for a given round by lowering to the closest KeyLiftime divisor.