Commit 06fe6fa
authored
feat: GF251 example (#1119)
This provides an implementation of additions and multiplications on the field GF251 for u8 elements. U8 have been chosen to be able to test all cases, even if only sampled in the final unit tests for performance reasons.
* addition
The function sums two u8s and returns the result modulo 251. It uses register splitting and carries to wrap around 251.
* multiplication
This function multiplies two u8s and returns the result modulo 251. For the multiplication function, we have implemented the Montgomery algorithm using R=256, co-prime with 251, and a reduce function. This algorithm shifts the modulo to the R chosen, here 256, where arithmetic can be achieved by register splitting and bit shifting. The reduce function then projects the result back to the 251 modulo.1 parent ad261e2 commit 06fe6fa
File tree
4 files changed
+7104
-0
lines changed- pkg/test
- testdata/asm/unit
4 files changed
+7104
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
0 commit comments