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>where
<P as Bls12Config>::G1Config: WBConfig,
WBMap<<P as Bls12Config>::G1Config>: MapToCurve<<E as Pairing>::G1>,
impl<E: Default + Pairing, P: Default + Bls12Config + CurveExtraConfig> Default for TinyBLS<E, P>where
<P as Bls12Config>::G1Config: WBConfig,
WBMap<<P as Bls12Config>::G1Config>: MapToCurve<<E as Pairing>::G1>,
Source§impl<E: Pairing, P: Bls12Config + CurveExtraConfig> EngineBLS for TinyBLS<E, P>where
<P as Bls12Config>::G1Config: WBConfig,
WBMap<<P as Bls12Config>::G1Config>: MapToCurve<<E as Pairing>::G1>,
impl<E: Pairing, P: Bls12Config + CurveExtraConfig> EngineBLS for TinyBLS<E, P>where
<P as Bls12Config>::G1Config: WBConfig,
WBMap<<P as Bls12Config>::G1Config>: MapToCurve<<E as Pairing>::G1>,
Source§fn minus_generator_of_public_key_group_prepared() -> Self::PublicKeyPrepared
fn minus_generator_of_public_key_group_prepared() -> Self::PublicKeyPrepared
Prepared negative of the generator of the public key curve.
const SIGNATURE_SERIALIZED_SIZE: usize = 48usize
const PUBLICKEY_SERIALIZED_SIZE: usize = 96usize
const SECRET_KEY_SIZE: usize = 32usize
const CURVE_NAME: &'static [u8] = P::CURVE_NAME
const SIG_GROUP_NAME: &'static [u8] = b"G1"
const CIPHER_SUIT_DOMAIN_SEPARATION: &'static [u8] = b"_XMD:SHA-256_SSWU_RO_"
type Engine = E
type Scalar = <<TinyBLS<E, P> as EngineBLS>::Engine as Pairing>::ScalarField
type SignatureGroup = <E as Pairing>::G1
type SignatureGroupAffine = <E as Pairing>::G1Affine
type SignaturePrepared = <E as Pairing>::G1Prepared
Source§type SignatureGroupBaseField = <<E as Pairing>::G1 as CurveGroup>::BaseField
type SignatureGroupBaseField = <<E as Pairing>::G1 as CurveGroup>::BaseField
Group where BLS signatures live Read more
type PublicKeyGroup = <E as Pairing>::G2
type PublicKeyGroupAffine = <E as Pairing>::G2Affine
type PublicKeyPrepared = <E as Pairing>::G2Prepared
Source§type PublicKeyGroupBaseField = <<E as Pairing>::G2 as CurveGroup>::BaseField
type PublicKeyGroupBaseField = <<E as Pairing>::G2 as CurveGroup>::BaseField
Group where BLS public keys live Read more
type HashToSignatureField = DefaultFieldHasher<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>>
type MapToSignatureCurve = WBMap<<P as Bls12Config>::G1Config>
Source§fn miller_loop<'a, I>(i: I) -> MillerLoopOutput<E>
fn miller_loop<'a, I>(i: I) -> MillerLoopOutput<E>
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
fn pairing<G2, G1>(p: G2, q: G1) -> E::TargetField
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>
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
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
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>>
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) -> boolwhere
Self::PublicKeyPrepared: 'a,
Self::SignaturePrepared: 'a,
I: IntoIterator<Item = &'a (Self::PublicKeyPrepared, Self::SignaturePrepared)>,
fn verify_prepared<'a, I>(signature: Self::SignaturePrepared, inputs: I) -> boolwhere
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
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
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
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>
fn signature_point_to_byte(point: &Self::SignatureGroup) -> Vec<u8>
Serialization helper for various sigma protocols
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>where
WBMap<<P as Bls12Config>::G1Config>: Sized,
<P as Bls12Config>::G1Config: Sized,
E: RefUnwindSafe,
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>where
WBMap<<P as Bls12Config>::G1Config>: Sized,
<P as Bls12Config>::G1Config: Sized,
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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