pub fn verify_batch<T, I>(
    transcripts: I,
    signatures: &[Signature],
    public_keys: &[PublicKey],
    deduplicate_public_keys: bool
) -> SignatureResult<()> where
    T: SigningTranscript,
    I: IntoIterator<Item = T>, 
Expand description

Verify a batch of signatures on messages with their respective public_keys.

Inputs

  • messages is a slice of byte slices, one per signed message.
  • signatures is a slice of Signatures.
  • public_keys is a slice of PublicKeys.
  • deduplicate_public_keys
  • csprng is an implementation of RngCore+CryptoRng, such as rand::ThreadRng.

Panics

This function will panic if the messages, signatures, and public_keys` slices are not equal length.

Returns

  • A Result whose Ok value is an emtpy tuple and whose Err value is a SignatureError containing a description of the internal error which occured.

Examples

use schnorrkel::{Keypair,PublicKey,Signature,verify_batch,signing_context};

let ctx = signing_context(b"some batch");
let mut csprng = rand::thread_rng();
let keypairs: Vec<Keypair> = (0..64).map(|_| Keypair::generate_with(&mut csprng)).collect();
let msg: &[u8] = b"They're good dogs Brant";
let signatures:  Vec<Signature> = keypairs.iter().map(|key| key.sign(ctx.bytes(&msg))).collect();
let public_keys: Vec<PublicKey> = keypairs.iter().map(|key| key.public).collect();

let transcripts = ::std::iter::once(ctx.bytes(msg)).cycle().take(64);

assert!( verify_batch(transcripts, &signatures[..], &public_keys[..], false).is_ok() );