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

Define hashing to scalar #301

Closed
bytemare opened this issue Feb 19, 2021 · 6 comments
Closed

Define hashing to scalar #301

bytemare opened this issue Feb 19, 2021 · 6 comments

Comments

@bytemare
Copy link

Just like hash_to_curve, maybe a function for hashing to a scalar (e.g. "hash_to_scalar") could be defined, that would be an alias of hash_to_field.

https://github.com/armfazh/h2c-go-ref implements such a functions

@claucece
Copy link

I think 'hash_to_field' should work for this.

The hash_to_field function is also suitable for securely hashing to scalars. For example, when hashing to scalars for an elliptic curve (sub)group with prime order r, it suffices to instantiate hash_to_curve with target field GF(r).

@claucece
Copy link

Sorry, my comment was going to be: not sure how different hash_to_scalar is from hash_to_field, as it seems like the last one is used for hashing to scalars.

@bytemare
Copy link
Author

Indeed, you're right, I totally missed that paragraph. Thank you for spotting it!

I wasn't thinking of anything different between the two: HashToScalar() would simply be an API naming convenience. So there would be HashToCurve() for points, and HashToScalar() for scalars, instead of HashToField().

But maybe this is totally irrelevant and not in the scope of the document.

@armfazh
Copy link
Collaborator

armfazh commented Feb 20, 2021

We used hashToField because this is a generic function that can be instantiated in, for example, hashToScalar. However, other applications can also use hashToField for their own purposes.

@bytemare
Copy link
Author

Yup, clear :) thank you both!

@paulmillr
Copy link

See caveat #343 (comment): hash_to_scalar produces 0..p-1 while scalars usually must be 1..p-1

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

No branches or pull requests

4 participants