sign/encoding/signature_codec library
Compression and decompression of Falcon signature vectors.
Bit-for-bit port of compress / decompress from the Python reference
(encoding.py). The scheme encodes each coefficient as:
- 1 sign bit (
1when negative,0otherwise); - the 7 low bits of
abs(coef), most-significant-bit first; - the high bits
abs(coef) >> 7in unary: that many0bits, then a terminating1. All coefficients are concatenated into one bit string, zero-padded to8 * slenbits, and packed MSB-first into bytes.
Web-safety: every value handled here is a small signature coefficient (well
under 2^53) or a single bit, so plain ints are sufficient throughout.