Documentation
¶
Index ¶
- Constants
- type Mat
- type Poly
- type PrivateKey
- type PublicKey
- type Scheme
- func (s *Scheme) GenerateKey(seed []byte) ([]byte, []byte, error)
- func (s *Scheme) Name() string
- func (d *Scheme) PackSig(z Vec, h Vec, hc []byte) []byte
- func (s *Scheme) PublicKeySize() int
- func (s *Scheme) Randomized() bool
- func (s *Scheme) SecretKeySize() int
- func (s *Scheme) Sign(sk []byte, msg []byte) ([]byte, error)
- func (s *Scheme) SignatureSize() int
- func (d *Scheme) UnpackSig(sig []byte) (Vec, Vec, []byte)
- func (s *Scheme) Verify(pk []byte, msg []byte, sig []byte) bool
- func (s *Scheme) WithRandomized(randomized bool) *Scheme
- type Vec
Constants ¶
const ( // SeedSize is the number of bytes required for Dilithium seed material. SeedSize = 32 // Public/secret key and signature sizes for the NIST-standardised ML-DSA // (Dilithium) parameter sets. These values mirror the definitions in // FIPS 204 / ML-DSA round 3. PublicKeySize44 = 1312 SecretKeySize44 = 2528 SignatureSize44 = 2420 PublicKeySize65 = 1952 SecretKeySize65 = 4000 SignatureSize65 = 3293 PublicKeySize87 = 2592 SecretKeySize87 = 4864 SignatureSize87 = 4595 )
Internal Dilithium constants shared across all parameter sets.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrivateKey ¶
type PrivateKey struct {
S1 Vec
S2 Vec
Rho [SeedSize]byte
Key [SeedSize]byte
Tr [SeedSize]byte
T0 Vec
}
PrivateKey represents the packed secret key structure.
type Scheme ¶
type Scheme struct {
// contains filtered or unexported fields
}
Scheme captures a concrete Dilithium / ML-DSA parameter set together with whether the signer operates in deterministic (false) or randomized (true) mode as defined in FIPS 204.
func NewDilithium2 ¶
NewDilithium2, NewDilithium3 and NewDilithium5 keep parity with the legacy naming used by the original reference implementations.
func NewDilithium3 ¶
func NewDilithium5 ¶
func NewMLDSA44 ¶
NewMLDSA44 returns the ML-DSA-44 (Dilithium-2) parameter set. By default the signer operates in randomized mode; pass randomized=false to force the deterministic variant.
func NewMLDSA65 ¶
NewMLDSA65 returns the ML-DSA-65 (Dilithium-3) parameter set.
func NewMLDSA87 ¶
NewMLDSA87 returns the ML-DSA-87 (Dilithium-5) parameter set.
func (*Scheme) GenerateKey ¶
GenerateKey returns packed public/secret key material. When seed is nil a fresh SeedSize-byte seed is sampled from crypto/rand. Providing a custom seed is primarily useful for deterministic test vectors.
func (*Scheme) PublicKeySize ¶
PublicKeySize returns the packed public key length in bytes.
func (*Scheme) Randomized ¶
Randomized returns true if the signer operates in randomized mode.
func (*Scheme) SecretKeySize ¶
SecretKeySize returns the packed secret key length in bytes.
func (*Scheme) Sign ¶
Sign produces a packed Dilithium signature over msg using the packed secret key encoded in sk.
func (*Scheme) SignatureSize ¶
SignatureSize returns the packed signature length in bytes.
func (*Scheme) UnpackSig ¶
UnpackSig unpacks a byte array into a signature. If the format is incorrect, nil objects are returned.
func (*Scheme) Verify ¶
Verify reports whether sig is a valid Dilithium signature on msg under the packed public key pk.
func (*Scheme) WithRandomized ¶
WithRandomized toggles the signing mode for the receiver and returns the mutated scheme for convenience.