Open sushisilence opened 3 months ago
See also: #492
For this specific case, I believe a quick Reduce<U256>
and Reduce<U512>
implementation should resolve it. Which seems straightforward using the existing from_bytes_mod_order
and from_bytes_mod_order_wide
. It will also make progress towards #492. WDYT @tarcieri?
It could potentially be implemented, although elliptic-curve
isn't currently a dependency and it might contain some assumptions about curves being of prime order
can i take on this ?
I'm not working on it, so you can go for it!
oky thanks , can i be assigned to it ?
Inconsistent scalar reduction across different curve implementations
Context
I'm developing a threshold signing library that needs to be generic over different elliptic curves, specifically targeting
k256
andcurve25519-dalek
. The library currently uses theGroup
trait for most operations, but I've encountered an issue with scalar reduction from U256.Problem
When implementing generic operations like Discrete Log proofs, I need to reduce a U256 value to a curve scalar. However, there's inconsistency in how different curve implementations handle this:
k256::Scalar
implements theReduce
trait.curve25519_dalek::Scalar
doesn't implementReduce
. Instead, it provides:from_bytes_mod_order
FromUniformBytes
traitThere's no common trait that both curves implement for modular reduction, which complicates writing generic code.
Questions
Reduce
trait forcurve25519-dalek::Scalar
?Additional Information
0.13.2
4.1.3
usinggroup
feature.Any guidance or suggestions would be greatly appreciated. Thank you!