Documentation
¶
Index ¶
- Variables
- func PackBits(vals []uint32, bits int) ([]byte, error)
- func PackPolyCoeffs(p *poly.Poly, bits int) ([]byte, error)
- func UnpackBits(data []byte, bits int, count int) ([]uint32, error)
- func UnpackHint(data []byte, omega int) ([]uint8, error)
- func UnpackPolyCoeffs(data []byte, bits int) (*poly.Poly, error)
- func UnpackPolyLeGamma1(data []byte, bits int) (*poly.Poly, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidBits is returned when a bit-width is out of the supported range. ErrInvalidBits = errors.New("pack: invalid bit width") // ErrOverflow is returned when a value does not fit within the requested width. ErrOverflow = errors.New("pack: value does not fit in requested bit width") // ErrInvalidLength is returned when the supplied byte slice is too short. ErrInvalidLength = errors.New("pack: input too short for requested unpack length") )
var ErrInvalidHint = errors.New("pack: invalid hint encoding")
ErrInvalidHint indicates an invalid hint encoding.
Functions ¶
func PackBits ¶
PackBits packs the provided coefficients into a byte slice using the supplied bit width. Values must already be reduced to fit within the provided width.
func PackPolyCoeffs ¶
PackPolyCoeffs encodes the polynomial coefficients into a bit-packed byte slice.
func UnpackBits ¶
UnpackBits unpacks exactly count values from data, each encoded with the supplied bit width.
func UnpackHint ¶ added in v0.2.4
UnpackHint decodes the hint vector h from the compressed representation used in ML-DSA. The encoding consists of omega indices followed by padding with 0xFF.
func UnpackPolyCoeffs ¶
UnpackPolyCoeffs decodes a bit-packed buffer into a polynomial, using the supplied bit width.
func UnpackPolyLeGamma1 ¶ added in v0.2.4
UnpackPolyLeGamma1 decodes a polynomial from the two's-complement centered representation used for z coefficients in ML-DSA. Each coefficient is stored as a signed little-endian integer with b bits (typically 18 or 20 depending on parameter set).
Types ¶
This section is empty.