Commit a77605a
committed
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.1 parent 0410b05 commit a77605a
1 file changed
+43
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
120 | 123 | | |
121 | 124 | | |
122 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
0 commit comments