Module commonware_cryptography::bls12381::primitives

source ·
Expand description

Operations over the BLS12-381 scalar field.

§Acknowledgements

The following crates were used as a reference when implementing this crate. If code is very similar to the reference, it is accompanied by a comment and link.

§Example

use commonware_cryptography::bls12381::{
    primitives::{ops::{partial_sign, partial_verify, aggregate, verify}, poly::public},
    dkg::ops::{generate_shares},
};

// Configure threshold
let (n, t) = (5, 4);

// Generate commitment and shares
let (commitment, shares) = generate_shares(None, n, t);

// Generate partial signatures from shares
let msg = b"hello world";
let partials: Vec<_> = shares.iter().map(|s| partial_sign(s, msg)).collect();

// Verify partial signatures
for p in &partials {
    partial_verify(&commitment, msg, p).expect("signature should be valid");
}

// Aggregate partial signatures
let threshold_sig = aggregate(t, partials).unwrap();

// Verify threshold signature
let threshold_pub = public(&commitment);
verify(&threshold_pub, msg, &threshold_sig).expect("signature should be valid");

Modules§

  • Group operations over the BLS12-381 scalar field.
  • Digital signatures over the BLS12-381 curve.
  • Polynomial operations over the BLS12-381 scalar field.

Enums§