-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathScalarOps.java
More file actions
43 lines (40 loc) · 1.19 KB
/
ScalarOps.java
File metadata and controls
43 lines (40 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* EdDSA-Java by str4d
*
* To the extent possible under law, the person who associated CC0 with
* EdDSA-Java has waived all copyright and related or neighboring rights
* to EdDSA-Java.
*
* You should have received a copy of the CC0 legalcode along with this
* work. If not, see <https://creativecommons.org/publicdomain/zero/1.0/>.
*
*/
package net.i2p.crypto.eddsa.math;
public interface ScalarOps {
/**
* Reduce the given scalar mod $l$.
* <p>
* From the Ed25519 paper:<br>
* Here we interpret $2b$-bit strings in little-endian form as integers in
* $\{0, 1,..., 2^{(2b)}-1\}$.
* @param s the scalar to reduce
* @return $s \bmod l$
*/
public byte[] reduce(byte[] s);
/**
* $r = (a * b + c) \bmod l$
* @param a a scalar
* @param b a scalar
* @param c a scalar
* @return $(a*b + c) \bmod l$
*/
public byte[] multiplyAndAdd(byte[] a, byte[] b, byte[] c);
/**
* Check, whether the given factor is valid and smaller than
* the group order.
*
* @param s A little-endian encoded factor.
* @return Whether <code>0 ≤ s < $l$</code>.
*/
public boolean isValidFactor(byte[] s);
}