Use w-NAF in `ka_orchard`

Improves the base-line cost of trial decryption by over 40%.
This commit is contained in:
Jack Grigg 2021-08-06 13:43:19 +01:00
parent fe923cc391
commit f4a8c082a9
2 changed files with 3 additions and 2 deletions

View File

@ -29,7 +29,7 @@ fpe = "0.4"
group = "0.10" group = "0.10"
halo2 = "0.0" halo2 = "0.0"
lazy_static = "1" lazy_static = "1"
pasta_curves = "0.1" pasta_curves = "0.1.2"
proptest = { version = "1.0.0", optional = true } proptest = { version = "1.0.0", optional = true }
rand = "0.8" rand = "0.8"
nonempty = "0.7" nonempty = "0.7"

View File

@ -218,7 +218,8 @@ pub(crate) fn ka_orchard(
sk: &NonZeroPallasScalar, sk: &NonZeroPallasScalar,
b: &NonIdentityPallasPoint, b: &NonIdentityPallasPoint,
) -> NonIdentityPallasPoint { ) -> NonIdentityPallasPoint {
NonIdentityPallasPoint(b.deref() * sk.deref()) let mut wnaf = group::Wnaf::new();
NonIdentityPallasPoint(wnaf.scalar(sk.deref()).base(*b.deref()))
} }
/// Coordinate extractor for Pallas. /// Coordinate extractor for Pallas.