MinPk

pub struct MinPk {}
Expand description

A Variant with a public key of type G1 and a signature of type G2.

Trait Implementations§

Source§

impl AsRef<<MinPk as Variant>::Public> for PublicKey

Source§

fn as_ref(&self) -> &<MinPk as Variant>::Public

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<<MinPk as Variant>::Signature> for Signature

Source§

fn as_ref(&self) -> &<MinPk as Variant>::Signature

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for MinPk

Source§

fn clone(&self) -> MinPk

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MinPk

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<<MinPk as Variant>::Public> for PublicKey

Source§

fn from(key: <MinPk as Variant>::Public) -> Self

Converts to this type from the input type.
Source§

impl From<<MinPk as Variant>::Signature> for Signature

Source§

fn from(signature: <MinPk as Variant>::Signature) -> Self

Converts to this type from the input type.
Source§

impl Hash for MinPk

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for MinPk

Source§

fn eq(&self, other: &MinPk) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Variant for MinPk

Source§

fn verify( public: &Self::Public, hm: &Self::Signature, signature: &Self::Signature, ) -> Result<(), Error>

Verifies that e(hm,pk) is equal to e(sig,G1::one()) using a single product check with a negated G1 generator (e(hm,pk) * e(sig,-G1::one()) == 1).

Source§

fn batch_verify<R: CryptoRngCore>( rng: &mut R, publics: &[Self::Public], hms: &[Self::Signature], signatures: &[Self::Signature], ) -> Result<(), Error>

Verifies a set of signatures against their respective public keys and pre-hashed messages.

This method is outperforms individual signature verification (2 pairings per signature) by verifying a random linear combination of the public keys and signatures (n+1 pairings and 2n multiplications for n signatures).

The verification equation for each signature i is: e(hm_i,pk_i) == e(sig_i,G1::one()), which is equivalent to checking if e(hm_i,pk_i) * e(sig_i,-G1::one()) == 1.

To batch verify n such equations, we introduce random non-zero scalars r_i (for i=1..n). The batch verification checks if the product of these individual equations, each raised to the power of its respective r_i, equals one: prod_i((e(hm_i,pk_i) * e(sig_i,-G1::one()))^{r_i}) == 1

Using the bilinearity of pairings, this can be rewritten (by moving r_i inside the pairings): prod_i(e(hm_i,r_i * pk_i) * e(r_i * sig_i,-G1::one())) == 1

The second term e(r_i * sig_i,-G1::one()) can be computed efficiently with Multi-Scalar Multiplication: e(sum_i(r_i * sig_i),-G1::one())

Finally, we aggregate all pairings e(hm_i,r_i * pk_i) (n) and e(sum_i(r_i * sig_i),-G1::one()) (1) into a single product in the target group G_T. If the result is the identity element in G_T, the batch verification succeeds.

Source: https://ethresear.ch/t/security-of-bls-batch-verification/10748

Source§

fn pairing(public: &Self::Public, signature: &Self::Signature) -> GT

Compute the pairing e(public, signature) -> GT.

Source§

const PROOF_OF_POSSESSION: DST = G2_PROOF_OF_POSSESSION

The domain separator tag (DST) for a proof of possession.
Source§

const MESSAGE: DST = G2_MESSAGE

The domain separator tag (DST) for a message.
Source§

type Public = G1

The public key type.
Source§

type Signature = G2

The signature type.
Source§

impl Eq for MinPk

Source§

impl StructuralPartialEq for MinPk

Auto Trait Implementations§

§

impl Freeze for MinPk

§

impl RefUnwindSafe for MinPk

§

impl Send for MinPk

§

impl Sync for MinPk

§

impl Unpin for MinPk

§

impl UnwindSafe for MinPk

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V