Open
Description
Derived from #705 and some discussion online, I find this constant particularly useful:
const ED25519_BASEPOINT_POINT_MUL_BY_COFACTOR: EdwardsPoint = EdwardsPoint{
X: FieldElement51::from_limbs([2233581206391315, 847321536719855, 1143763522071466, 2176635986873503, 544015092356874]),
Y: FieldElement51::from_limbs([810168548829118, 1091277158180317, 1905862677914949, 871313444918061, 2245667822025877]),
Z: FieldElement51::from_limbs([207037345464830, 1993080251615457, 560932193579569, 999626924140364, 754134581836708]),
T: FieldElement51::from_limbs([606549093027129, 120708372070681, 50079640475349, 1940797268843777, 623236962379938])
};
This is because in my way to generate ed25519 keys:
let ED25519_BASEPOINT_POINT_MUL_BY_COFACTOR = ED25519_BASEPOINT_POINT.mul_by_cofactor(); // Not constant at the moment
let mut rng = Rng::new();
let expanded_sk: [u8; 32] =
Sha512::default()
.chain_update({
let mut sk = SecretKey::default();
rng.fill(&mut sk);
sk
})
.finalize()[..32]
.try_into()
.unwrap();
let mut count: usize = 0;
let mut pk = ED25519_BASEPOINT_POINT.mul_clamped(expanded_sk);
loop {
// foo(pk.compress().to_bytes());
count += 1;
pk += ED25519_BASEPOINT_POINT_MUL_BY_COFACTOR;
}
// expanded_sk += 8 * count;
The performance improved the generation by 3 orders of magnitude, so now the Edwards point compression is the only hot path now. Is it possible to do addition arithmetic on compressed Edwards point directly?
Metadata
Metadata
Assignees
Labels
No labels
Activity