Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test the Elligator Squared mapping functions
- source: src/modules/ellsq/tests_impl.h from bitcoin-core/secp256k1#982 - 3 tests are added: 1. Generate random field elements and use f to map it to a valid group element on the curve. Then use r to map back the group element to the 4 possible pre-images, out of which only 1 is the field element we started with. 2. Generate random group elements on the curve and use r to map it to the 4 possible pre-images. Then map the field elements back to the group element and check if it's the same group element we started with, also making sure that the pre-images are distinct. 3. Verify the test cases which consists of group element and the 4 field elements.Map the group element to the 4 possible pre-images using r and check whether it's consistent with the 4 field elements given in the test case. Map the field element back to the group element using f and check whether it matches the test case.
- Loading branch information