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

Add jubjub twisted edwards curve to stdlib #1259

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open

Add jubjub twisted edwards curve to stdlib #1259

wants to merge 15 commits into from

Conversation

dark64
Copy link
Member

@dark64 dark64 commented Jan 4, 2023

@alvaro-alonso
Copy link

@dark64 rebasing the source branch should solve the failing check

@dark64 dark64 marked this pull request as ready for review October 4, 2023 16:33
@dark64 dark64 changed the title Add jubjub twisted edwards curve to stdlib (wip) Add jubjub twisted edwards curve to stdlib Oct 4, 2023
Copy link

@alvaro-alonso alvaro-alonso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I keep in mind format and changelog for next time ✍️ everything else looks good to me

@dark64 dark64 requested a review from Schaeff October 9, 2023 10:40
@alvaro-alonso
Copy link

@Schaeff can you please review the branch? 👾

def main(field i) -> bool[256] {
bool[254] b = unpack_unchecked(i);
return [false, false, ...b];
def main(field i, u32 bit_size) -> bool[256] {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: After a second look, I figure this function should have better documentation

cc @alvaro-alonso

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dark64 good point!

What about:

import "./unpack_unchecked";

// Unpack a field element as 256 big-endian bits.
// Since the size of p can differ among different fields, 
// p_size has to be given to derive the correct padding.
// For example, for bn128 |p|=254, for bls12-381 |p|=255.
// Note: uniqueness of the output is not guaranteed
// For example, `0` can map to `[0, 0, ..., 0]` or to `bits(p)`
def main(field i, u32 p_size) -> bool[256] {
    assert(p_size <= 256);
    u32 padding_size = 256 - p_size;
    bool[p_size] b = unpack_unchecked(i);
    return [...[false; padding_size], ...b];
}

I can not push the changes to the branch. And I think a PR is overkill 💀

@alvaro-alonso alvaro-alonso mentioned this pull request Jan 2, 2024
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.

None yet

2 participants