Comments (6)
Thus far we've deliberately avoided exposing field elements in order to provide a misuse resistant API.
For hash2curve specifically my suggestion would be defining traits for hash2curve in the elliptic-curve
crate and then implementing them directly in k256
/p256
.
cc @str4d
from elliptic-curves.
I agree with @tarcieri. I would definitely like to see a hash-to-curve trait (either in group
or elliptic-curve
) that can provide this functionality, and if the hash-to-field component of the ID proves to be more widely-useful, then a trait to that effect could end up in ff
.
from elliptic-curves.
Wouldn't this effectively require implementing SSWU and related logic twice, once for each curve?
from elliptic-curves.
You should be able to define it as e.g. a generic function somewhere like elliptic-curve
.
If you're having trouble go ahead and do a copy-and-paste definition for each crate individually and I can take a look at extracting out a generic implementation.
from elliptic-curves.
Another approach that might work for abstracting SSWU would be to define a trait (e.g. Sswu
) intended to be impl'd on a curve-specific FieldElement
type, which has a map_to_curve_simple_swu
function with a default impl and an associated curve-specific const Z
.
Then all curve-specific impls of that trait would need to do is define Z
.
Something like this perhaps?
pub trait Sswu: // arithmetic bounds go here
{
const Z: Self;
fn map_to_curve_simple_swu(&self) -> (Self, Self) {
...
}
}
from elliptic-curves.
Generic optimized SWU has been added upstream to the elliptic-curve
crate: RustCrypto/traits#854
from elliptic-curves.
Related Issues (20)
- Update crates to the newtype `fiat-crypto` codegen
- Request: Instructions to reproduce fiat-crypto files HOT 2
- Using ECDSA key pair for ECDH HOT 1
- Prepend the TapSigHash tag when doing k256 Schnorr signatures? HOT 1
- bp256+bp384: tracking issue for `arithmetic` feature HOT 3
- Numerous unused variable cause Rust difficulties HOT 3
- Bug(deps) p521 crate requires ecdsa 16.8 HOT 2
- BIP340 Schnorr should accept arbitrary length messages HOT 6
- p256::Scalar: implement Reduce<U512> HOT 1
- PKCS8: Cannot parse PrivateKey HOT 2
- Asymmetry in default features: only p384 has `ecdh` by default HOT 2
- Poseidon Support for k256 Hash To Curve HOT 1
- Document use with the PKCS#8 HOT 1
- Pre-release of k256 v0.14? HOT 3
- k256 does not compile without allocator HOT 5
- primeorder 0.13.4 update breaks p384 0.13.0 builds HOT 4
- k256 disrepency in secp256k1 key recover HOT 12
- How to convert a VerifyingKey of type FieldElement10x26 to a FieldElement5x52 type
- k256: v0.13.2 breaking verification HOT 9
- Bitwise operations for scalars HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elliptic-curves.