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

HashToPoint for Ed25519 (for pedersen commitments) #1

Open
HarryR opened this issue Aug 14, 2018 · 2 comments
Open

HashToPoint for Ed25519 (for pedersen commitments) #1

HarryR opened this issue Aug 14, 2018 · 2 comments

Comments

@HarryR
Copy link

HarryR commented Aug 14, 2018

See find_group_hash @ https://github.com/daira/zcash-test-vectors/blob/master/sapling_generators.py#L31

def group_hash(D, M):
    digest = blake2s(person=D)
    digest.update(CRS)
    digest.update(M)
    p = Point.from_bytes(digest.digest())
    if not p:
        return None
    q = p * JUBJUB_COFACTOR
    if q == Point.ZERO:
        return None
    return q

def find_group_hash(D, M):
    i = 0
    while True:
        p = group_hash(D, M + bytes([i]))
        if p:
            return p
        i += 1
        assert i < 256
@barryWhiteHat
Copy link
Owner

The problem is Point.from_bytes call. You can follow it to sapling_jubjub.py and you can see it needs to get the square root (u = u2.sqrt())[https://github.com/daira/zcash-test-vectors/blob/master/sapling_jubjub.py#L157)

I have not gotten that working yet. You can see https://github.com/barryWhiteHat/baby_jubjub_ecc/blob/master/tests/sapling_jubjub.py#L81 that i am trying to reverse engineer it. But have not gotten it to work yet.

@HarryR
Copy link
Author

HarryR commented Aug 14, 2018

Can you not just provide a witness for the points u coordinate and verify is_on_curve(u, v) and v == v_from_hash(...) ?

One problem with that is there may be more than one u coordinate for any given v and visa versa, e.g. negative points with the sign bit have the X coordinate flipped.

So it's not safe to just verify is_on_curve unless you also verify the sign bit of the encoded point and whether or not the X coord is negative or positive.

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

2 participants