SignatureBatchVerify

Trait SignatureBatchVerify 

Source
pub trait SignatureBatchVerify: Signature {
    // Required method
    fn batch_verify(
        messages: &[&[u8]],
        signatures: &[Self::SignatureData],
        public_keys: &[Self::PublicKey],
    ) -> Result<()>;
}
Expand description

Optional trait for batch signature verification

Some algorithms (like Ed25519) support efficient batch verification of multiple signatures.

Required Methods§

Source

fn batch_verify( messages: &[&[u8]], signatures: &[Self::SignatureData], public_keys: &[Self::PublicKey], ) -> Result<()>

Verify multiple signatures in a batch

§Parameters
  • messages: Slice of messages to verify
  • signatures: Corresponding signatures
  • public_keys: Corresponding public keys

All three slices must have the same length.

§Returns
  • Ok(()) if all signatures are valid
  • Err(_) if any signature is invalid or inputs are malformed
§Performance

This should be significantly faster than verifying each signature individually when the batch size is large.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§