Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Mike Hamburg's Ristretto #23

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

bwesterb
Copy link

Many cryptographic schemes assume a group of prime order. Edwards25519 is not a group of prime order (it has order 8 * l, where l is the order of the usual base point.) This has not prevented people using Edwards25519 nonetheless — some carefully check whether this cofactor 8 impacts the security of the scheme at hand whereas others are more reckless.

There is, however, a convenient way to construct a group of prime order (l in fact) from Edwards25519 suggested by Mike Hamburg ( @bitwiseshiftleft ). Let's call his group the Ristretto group. The Ristretto group is the subgroup of even points quotiented by the points-of-order-less-than-equal-four.

This PR adds two function

  • ToRistrettoBytes() takes an even point and returns a binary encoding of the corresponding element in the the Ristretto group.

  • FromRistrettoBytes() takes a buffer and checks whether it encodes an element of the Ristretto group. If it does, the function returns a point representing the encoded element of the Ristretto group.

Code is based on the Ristretto implementation in an unpublished version of the Panda library by Peter Schwabe ( @cryptojedi )

A similar feature was requested for libsodium: jedisct1/libsodium#704
Ristretto is already implemented in Rust in https://github.com/dalek-cryptography/curve25519-dalek

Edwards25519 is not a group of prime order --- it has order 8 * l, where l
is the (prime) order of the basepoint.  Mike Hamurg's Ristretto is a
convenient method to construct a group of order l from Edwards25519 as a
subquotient (quotient of a subgroup).

Half of the points of Edwards25519 are "in" the Ristretto group.  (It's
the even points.)  Every element of the Ristretto group has exactly four
points that represent it in the Edwards25519 curve. (Points are
equivalent iff they differ by a point of order less than or equal 4.)

This commit adds two functions.

ToRistrettoBytes() takes an even curvepoint and returns a binary
encoding of the corresponding tlement of the Ristretto group.

FromRistrettoBytes() takes a buffer and checks whether it is a binary
encoding of an element of the Ristretto group.  If it is, the function
returns a point that represents the encoded element of the Ristretto group.
@bwesterb
Copy link
Author

bwesterb commented Jun 4, 2018

I would prefer Ristretto to be part of the standard library, but in the meantime I have separate package bwesterb/go-ristretto.

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.

1 participant