Documentation ¶
Index ¶
Constants ¶
const ( // FalconSeedSize Represents the size in bytes of the random bytes used to generate Falcon keys FalconSeedSize = 48 // FalconMaxSignatureSize Represents the max possible size in bytes of a falcon signature FalconMaxSignatureSize = cfalcon.CTSignatureSize )
const ( Sha512_256Size = sha512.Size256 SumhashDigestSize = sumhash.Sumhash512DigestSize Sha256Size = sha256.Size )
size of each hash
const MaxHashDigestSize = SumhashDigestSize
MaxHashDigestSize is used to bound the max digest size. it is important to change it if a hash with a longer output is introduced.
Variables ¶
var ErrInvalidObject = errors.New("unmarshalled object is invalid")
ErrInvalidObject is used to state that an object decoding has failed because it's invalid.
Functions ¶
func GenericHashObj ¶
GenericHashObj Makes it easier to sum using hash interface and Hashable interface
Types ¶
type FalconPrivateKey ¶
type FalconPrivateKey [cfalcon.PrivateKeySize]byte
FalconPrivateKey is a wrapper for cfalcon.PrivateKeySize (used for packing)
type FalconPublicKey ¶
type FalconPublicKey [cfalcon.PublicKeySize]byte
FalconPublicKey is a wrapper for cfalcon.PublicKeySizey (used for packing)
type FalconSeed ¶
type FalconSeed [FalconSeedSize]byte
FalconSeed represents the seed which is being used to generate Falcon keys
type FalconSignature ¶
type FalconSignature []byte
FalconSignature represents a Falcon signature in a compressed-form
func (FalconSignature) GetFixedLengthHashableRepresentation ¶
func (s FalconSignature) GetFixedLengthHashableRepresentation() ([]byte, error)
GetFixedLengthHashableRepresentation returns a serialized version of the signature
func (FalconSignature) IsSaltVersionEqual ¶
func (s FalconSignature) IsSaltVersionEqual(version byte) bool
IsSaltVersionEqual of the signature matches the given version
func (FalconSignature) MsgIsZero ¶
func (s FalconSignature) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
type FalconVerifier ¶
type FalconVerifier struct { PublicKey FalconPublicKey `codec:"k"` // contains filtered or unexported fields }
FalconVerifier implements the type Verifier interface for the falcon signature scheme.
func (*FalconVerifier) GetFixedLengthHashableRepresentation ¶
func (d *FalconVerifier) GetFixedLengthHashableRepresentation() []byte
GetFixedLengthHashableRepresentation is used to fetch a plain serialized version of the public data (without the use of the msgpack).
func (*FalconVerifier) MsgIsZero ¶
func (d *FalconVerifier) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*FalconVerifier) VerifyBytes ¶
func (d *FalconVerifier) VerifyBytes(data []byte, sig FalconSignature) error
VerifyBytes follows falcon algorithm to verify a signature.
type GenericDigest ¶
type GenericDigest []byte
GenericDigest is a digest that implements CustomSizeDigest, and can be used as hash output.
func (GenericDigest) IsEmpty ¶
func (d GenericDigest) IsEmpty() bool
IsEmpty checks wether the generic digest is an empty one or not
func (GenericDigest) IsEqual ¶
func (d GenericDigest) IsEqual(other GenericDigest) bool
IsEqual compare two digests
func (GenericDigest) ToSlice ¶
func (d GenericDigest) ToSlice() []byte
ToSlice is used inside the Tree itself when interacting with TreeDigest
type HashFactory ¶
type HashFactory struct { HashType HashType `codec:"t"` // contains filtered or unexported fields }
HashFactory is responsible for generating new hashes accordingly to the type it stores.
func (*HashFactory) MsgIsZero ¶
func (z *HashFactory) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (HashFactory) NewHash ¶
func (z HashFactory) NewHash() hash.Hash
NewHash generates a new hash.Hash to use.
func (*HashFactory) Validate ¶
func (z *HashFactory) Validate() error
Validate states whether the HashFactory is valid, and is safe to use.
type HashID ¶
type HashID string
HashID is a domain separation prefix for an object type that might be hashed This ensures, for example, the hash of a transaction will never collide with the hash of a vote
type Hashable ¶
Hashable is an interface implemented by an object that can be represented with a sequence of bytes to be hashed or signed, together with a type ID to distinguish different types of objects.
type MessageHash ¶
type MessageHash [32]byte
MessageHash represents the message that a state proof will attest to.