| 1 | /** |
| 2 | * EdDSA-Java by str4d |
| 3 | * |
| 4 | * To the extent possible under law, the person who associated CC0 with |
| 5 | * EdDSA-Java has waived all copyright and related or neighboring rights |
| 6 | * to EdDSA-Java. |
| 7 | * |
| 8 | * You should have received a copy of the CC0 legalcode along with this |
| 9 | * work. If not, see <https://creativecommons.org/publicdomain/zero/1.0/>. |
| 10 | * |
| 11 | */ |
| 12 | package net.i2p.crypto.eddsa.math; |
| 13 | |
| 14 | public interface ScalarOps { |
| 15 | /** |
| 16 | * Reduce the given scalar mod $l$. |
| 17 | * <p> |
| 18 | * From the Ed25519 paper:<br> |
| 19 | * Here we interpret $2b$-bit strings in little-endian form as integers in |
| 20 | * $\{0, 1,..., 2^{(2b)}-1\}$. |
| 21 | * @param s the scalar to reduce |
| 22 | * @return $s \bmod l$ |
| 23 | */ |
| 24 | public byte[] reduce(byte[] s); |
| 25 | |
| 26 | /** |
| 27 | * $r = (a * b + c) \bmod l$ |
| 28 | * @param a a scalar |
| 29 | * @param b a scalar |
| 30 | * @param c a scalar |
| 31 | * @return $(a*b + c) \bmod l$ |
| 32 | */ |
| 33 | public byte[] multiplyAndAdd(byte[] a, byte[] b, byte[] c); |
| 34 | } |