w3f_bls::engine

Struct TinyBLS

Source
pub struct TinyBLS<E: Pairing, P: Bls12Config + CurveExtraConfig>(pub E, _)
where
    <P as Bls12Config>::G1Config: WBConfig,
    WBMap<<P as Bls12Config>::G1Config>: MapToCurve<<E as Pairing>::G1>;
Expand description

Infrequently used BLS variant with tiny 48 byte signatures and 96 byte public keys,

We recommend gainst this variant by default because verifiers always perform O(signers) additions on the PublicKeyGroup, or worse 128 bit scalar multiplications with delinearization. Yet, there are specific use cases where this variant performs better. We swapy two group roles relative to zcash here.

Tuple Fields§

§0: E

Trait Implementations§

Source§

impl<E: Default + Pairing, P: Default + Bls12Config + CurveExtraConfig> Default for TinyBLS<E, P>

Source§

fn default() -> TinyBLS<E, P>

Returns the “default value” for a type. Read more
Source§

impl<E: Pairing, P: Bls12Config + CurveExtraConfig> EngineBLS for TinyBLS<E, P>

Source§

fn minus_generator_of_public_key_group_prepared() -> Self::PublicKeyPrepared

Prepared negative of the generator of the public key curve.

Source§

const SIGNATURE_SERIALIZED_SIZE: usize = 48usize

Source§

const PUBLICKEY_SERIALIZED_SIZE: usize = 96usize

Source§

const SECRET_KEY_SIZE: usize = 32usize

Source§

const CURVE_NAME: &'static [u8] = P::CURVE_NAME

Source§

const SIG_GROUP_NAME: &'static [u8] = b"G1"

Source§

const CIPHER_SUIT_DOMAIN_SEPARATION: &'static [u8] = b"_XMD:SHA-256_SSWU_RO_"

Source§

type Engine = E

Source§

type Scalar = <<TinyBLS<E, P> as EngineBLS>::Engine as Pairing>::ScalarField

Source§

type SignatureGroup = <E as Pairing>::G1

Source§

type SignatureGroupAffine = <E as Pairing>::G1Affine

Source§

type SignaturePrepared = <E as Pairing>::G1Prepared

Source§

type SignatureGroupBaseField = <<E as Pairing>::G1 as CurveGroup>::BaseField

Group where BLS signatures live Read more
Source§

type PublicKeyGroup = <E as Pairing>::G2

Source§

type PublicKeyGroupAffine = <E as Pairing>::G2Affine

Source§

type PublicKeyPrepared = <E as Pairing>::G2Prepared

Source§

type PublicKeyGroupBaseField = <<E as Pairing>::G2 as CurveGroup>::BaseField

Group where BLS public keys live Read more
Source§

type HashToSignatureField = DefaultFieldHasher<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>

Source§

type MapToSignatureCurve = WBMap<<P as Bls12Config>::G1Config>

Source§

fn miller_loop<'a, I>(i: I) -> MillerLoopOutput<E>
where I: IntoIterator<Item = &'a (Self::PublicKeyPrepared, Self::SignaturePrepared)>,

Run the Miller loop from Engine but orients its arguments to be a SignatureGroup and PublicKeyGroup.
Source§

fn pairing<G2, G1>(p: G2, q: G1) -> E::TargetField
where G1: Into<E::G1Affine>, G2: Into<E::G2Affine>,

Performs a pairing operation e(p, q) by calling Engine::pairing but orients its arguments to be a PublicKeyGroup and SignatureGroup.
Source§

fn hash_to_curve_map() -> MapToCurveBasedHasher<Self::SignatureGroup, Self::HashToSignatureField, Self::MapToSignatureCurve>

getter function for the hash to curve map
Source§

fn generate<R: Rng + RngCore>(rng: &mut R) -> Self::Scalar

Generate a random scalar for use as a secret key.
Source§

fn hash_to_signature_curve<M: Borrow<[u8]>>(message: M) -> Self::SignatureGroup

Hash one message to the signature curve.
Source§

fn final_exponentiation( e: MillerLoopOutput<Self::Engine>, ) -> Option<PairingOutput<Self::Engine>>

Perform final exponentiation on the result of a Miller loop.
Source§

fn verify_prepared<'a, I>(signature: Self::SignaturePrepared, inputs: I) -> bool
where Self::PublicKeyPrepared: 'a, Self::SignaturePrepared: 'a, I: IntoIterator<Item = &'a (Self::PublicKeyPrepared, Self::SignaturePrepared)>,

Implement verification equation for aggregate BLS signatures provided as prepared points Read more
Source§

fn generator_of_signature_group() -> Self::SignatureGroup

return the generator of signature group
Source§

fn prepare_public_key( g: impl Into<Self::PublicKeyGroupAffine>, ) -> Self::PublicKeyPrepared

Process the public key to be use in pairing. This has to be implemented by the type of BLS system implementing the engine by calling either prepare_g1 or prepare_g2 based on which group is used by the signature system to host the public key
Source§

fn prepare_signature( g: impl Into<Self::SignatureGroupAffine>, ) -> Self::SignaturePrepared

Process the signature to be use in pairing. This has to be implemented by the type of BLS system implementing the engine by calling either prepare_g1 or prepare_g2 based on which group is used by the signature system to host the public key
Source§

fn signature_point_to_byte(point: &Self::SignatureGroup) -> Vec<u8>

Serialization helper for various sigma protocols
Source§

fn public_key_point_to_byte(point: &Self::PublicKeyGroup) -> Vec<u8>

Auto Trait Implementations§

§

impl<E, P> Freeze for TinyBLS<E, P>

§

impl<E, P> RefUnwindSafe for TinyBLS<E, P>

§

impl<E, P> Send for TinyBLS<E, P>

§

impl<E, P> Sync for TinyBLS<E, P>

§

impl<E, P> Unpin for TinyBLS<E, P>

§

impl<E, P> UnwindSafe for TinyBLS<E, P>

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> 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> Same for T

Source§

type Output = T

Should always be Self
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