pub struct FalconSignature { /* private fields */ }Expand description
A Falcon digital signature.
Contains the encoded signature bytes in constant-time (CT) format.
Signatures can be exported with to_bytes and
imported with from_bytes.
§Wire Format
The signature bytes include a 1-byte header, 40-byte nonce, and the encoded signature coefficients. The total size is fixed for CT format (809 bytes for Falcon-512, 1577 bytes for Falcon-1024).
Implementations§
Source§impl FalconSignature
impl FalconSignature
Sourcepub fn from_bytes(data: Vec<u8>) -> Self
pub fn from_bytes(data: Vec<u8>) -> Self
Create a signature from raw bytes (deserialization).
The bytes must be a valid Falcon signature in any supported format.
No verification is performed — use verify to
check validity.
§Example
let kp = FalconKeyPair::generate(9).unwrap();
let sig = kp.sign(b"msg").unwrap();
// Round-trip through bytes
let bytes = sig.to_bytes().to_vec();
let sig2 = FalconSignature::from_bytes(bytes);Sourcepub fn verify(
sig: &[u8],
pubkey: &[u8],
message: &[u8],
) -> Result<(), FalconError>
pub fn verify( sig: &[u8], pubkey: &[u8], message: &[u8], ) -> Result<(), FalconError>
Verify a signature against a public key and message.
Accepts signatures in any Falcon format (COMPRESSED, PADDED, CT) — the format is auto-detected from the header byte.
§Arguments
sig— The encoded signature bytes.pubkey— The encoded public key bytes.message— The original message that was signed.
§Returns
Ok(()) if valid, Err(FalconError::BadSignature) otherwise.
§Example
let kp = FalconKeyPair::generate(9).unwrap();
let sig = kp.sign(b"msg").unwrap();
FalconSignature::verify(sig.to_bytes(), kp.public_key(), b"msg").unwrap();Sourcepub fn to_bytes(&self) -> &[u8] ⓘ
pub fn to_bytes(&self) -> &[u8] ⓘ
Get the raw signature bytes (serialization).
The returned bytes can be stored, transmitted, and later restored
with from_bytes.
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Consume the signature and return the owned byte vector.
Trait Implementations§
Source§impl Clone for FalconSignature
impl Clone for FalconSignature
Source§fn clone(&self) -> FalconSignature
fn clone(&self) -> FalconSignature
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more