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

Rust and Sage Implementation do not hash to the same point on the same input #4

Closed
drskalman opened this issue Nov 8, 2022 · 4 comments

Comments

@drskalman
Copy link

See: w3f-grants-archive/Indifferentiable-hashing-to-ordinary-elliptic-curves-of-j-0-with-the-cost-of-one-exponentiation@6aefa9c

n$ sage Indifferentiable\ hashing\ with\ the\ cost\ of\ one\ exponentiation.sage
FF
======================================================================
FAIL: test_bls12_377_test_vector (__main__.TestIndiffJInvJ0Hash)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/skalman/code/Indifferentiable-hashing-to-ordinary-elliptic-curves-of-j-0-with-the-cost-of-one-exponentiation/Indifferentiable hashing with the cost of one exponentiation.sage.py", line 434, in test_bls12_377_test_vector
    assert(X/Z == bls12_377_test_vector[i*_sage_const_2 ] and Y/Z == bls12_377_test_vector[i*_sage_const_2 +_sage_const_1 ])
AssertionError

======================================================================
FAIL: test_bls12_381_test_vector (__main__.TestIndiffJInvJ0Hash)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/skalman/code/Indifferentiable-hashing-to-ordinary-elliptic-curves-of-j-0-with-the-cost-of-one-exponentiation/Indifferentiable hashing with the cost of one exponentiation.sage.py", line 420, in test_bls12_381_test_vector
    assert(X/Z == bls12_381_test_vector[i*_sage_const_2 ] and Y/Z == bls12_381_test_vector[i*_sage_const_2 +_sage_const_1 ])
AssertionError

----------------------------------------------------------------------
Ran 2 tests in 13.365s

FAILED (failures=2)
@zhenfeizhang
Copy link
Owner

@drskalman
Copy link
Author

I used the updated test vetors. The test passes for BLS12-377 but they still fails for BLS12-381:

======================================================================
FAIL: test_bls12_381_test_vector (__main__.TestIndiffJInvJ0Hash)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/skalman/code/Indifferentiable-hashing-to-ordinary-elliptic-curves-of-j-0-with-the-cost-of-one-exponentiation/Indifferentiable hashing with the cost of one exponentiation.sage.py", line 421, in test_bls12_381_test_vector
    assert(X/Z == bls12_381_test_vector[i*_sage_const_2 ] and Y/Z == bls12_381_test_vector[i*_sage_const_2 +_sage_const_1 ])
AssertionError

----------------------------------------------------------------------
Ran 6 tests in 13.791s

FAILED (failures=1)

@zhenfeizhang
Copy link
Owner

It should be fixed now.

@drskalman
Copy link
Author

Indeed:

----------------------------------------------------------------------
Ran 6 tests in 14.782s

OK

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