Skip to content

Instantly share code, notes, and snippets.

@Pratyush
Created August 23, 2020 16:25
Show Gist options
  • Save Pratyush/10331e98656f190af210fa544fdc217a to your computer and use it in GitHub Desktop.
Save Pratyush/10331e98656f190af210fa544fdc217a to your computer and use it in GitHub Desktop.
pub trait GlvMul {
// whatever trait methods you need
}
pub trait SWModelParameters {
fn scalar_mul(thing: SWAffine<Self>, other: bits) -> SWAffine<Self> {
// default double and add impl
}
}
impl GlvMul for bls12_377::G1 { // or bls12_377::G1Parameters
// stuff
}
impl SWModelParameters for bls12_377::G1Parameters {
// other stuff here
fn scalar_mul(thing: SWAffine<Self>, other: bits) -> SWAffine<Self> {
// Glv based impl that invokes
}
}
//////////////////////////////////////////////////////////////
// In short_weierstrass_jacobian.rs
impl<P: SWModelParameters> SWAffine<P> {
fn mul_bits(&self, other: bits) -> Self {
P::scalar_mul(&self, other)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment