Question on private scalar derivation (ed25519) #109
-
noble-curves/src/abstract/edwards.ts Lines 424 to 427 in 0a66339 As far as I understand, the reason for bit clamping ed25519 keys is to mitigate small subgroup attacks. This is achieved by ensuring that the secret scalar is a multiple of 8 (by clamping the 3 lowest order bits). In line 427, however, the clamped secret scalar is reduced modulo the prime group order (and thereby the bit representation is changed). Doesn't this defeat the purpose of the clamping? Shouldn't the final scalar have the 3 lowest order bits zeroed out? Or am I getting something wrong here? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I'll try to answer my own question here. In the case of In the case of noble-curves/src/abstract/montgomery.ts Lines 157 to 163 in 0a66339 |
Beta Was this translation helpful? Give feedback.
-
yeah we just follow the spec even if it doesn’t matter much |
Beta Was this translation helpful? Give feedback.
I'll try to answer my own question here.
In the case of
ed25519
signatures, this modulo operation does not have an effect, since we know that we are operating on points of the prime order subgroup.In the case of
x25519
this would have an effect, but here we are not applying the modulo operation.noble-curves/src/abstract/montgomery.ts
Lines 157 to 163 in 0a66339