Skip to content

Conversation

@daxpedda
Copy link
Contributor

@daxpedda daxpedda commented Jul 8, 2025

Because Ed448 and Decaf448 have different scalar representations, we need two separate types.

This PR achieves this by making Scalar generic and adding two new types:

  • type EdwardsScalar = Scalar<Ed448>
  • type DecafScalar = Scalar<Decaf448>

Scalar itself must still be publicly visible to allow its methods and implementations to show up in the documentation. A new private trait CurveWithScalar is introduced to let implementations differentiate between both curves. Because Scalar<C: CurveWithScalar> relies on this private trait Scalar can't be used by users with other curves.

Alternatively we could also achieve the same result with a huge macro instead of a shared generic Scalar type. Let me know if you prefer that instead.

Resolves #1229.

@daxpedda daxpedda force-pushed the ed448-scalar-split branch 2 times, most recently from e24ed71 to 45d1c82 Compare July 8, 2025 16:27
@daxpedda
Copy link
Contributor Author

daxpedda commented Jul 8, 2025

Just realized that the scalar representation isn't the only difference that necessitates this change. Decaf448 also requires a different FromOkm implementation for hash2curve.

I went ahead and fixed that as well here.

@daxpedda daxpedda force-pushed the ed448-scalar-split branch from 0b0e1a6 to a3a89d3 Compare July 8, 2025 19:44
@daxpedda daxpedda force-pushed the ed448-scalar-split branch from a3a89d3 to eb65078 Compare July 8, 2025 21:13
@tarcieri tarcieri changed the title Split Scalar into EdwardsScalar and DecafScalar ed448-goldilocks: split Scalar into EdwardsScalar/DecafScalar Jul 8, 2025
@tarcieri tarcieri merged commit d338e11 into RustCrypto:master Jul 8, 2025
20 checks passed
@baloo baloo mentioned this pull request Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ed448-goldilocks: 56-byte decaf x-coordinates

2 participants