Skip to content
New issue

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

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

Already on GitHub? # to your account

Malleable field elements #45

Merged
merged 1 commit into from
Aug 1, 2021
Merged

Malleable field elements #45

merged 1 commit into from
Aug 1, 2021

Conversation

irakliyk
Copy link
Collaborator

@irakliyk irakliyk commented Jul 31, 2021

This PR introduces a concept of malleable field elements - i.e., elements which might have redundant internal representation for the same canonical representation. For example, this is the case for field elements where internally elements are stored in the range [0, 2M) (rather than [0, M)) which we use for our f62 field (the f128 field does not have this issue because we don't use Montgomery arithmetic for it).

This also allows us to hash elements consistently by first normalizing their internal representation, and only then hashing them. We do this for malleable elements only, since non-malleable elements don't need to be normalized, and thus, we can hash them directly.

We also make sure that we always write elements into the proof in canonical representation. This avoids issues when trying to deserialize elements where canonical and internal representations differ.

The above fixes should resolve the problems mentioned in #13 (comment).

@irakliyk irakliyk merged commit aaa9269 into main Aug 1, 2021
@irakliyk irakliyk deleted the melleable-field-elements branch August 1, 2021 04:14
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants