|
Bouncy Castle Cryptography Library 1.49 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.bouncycastle.pqc.math.ntru.util.Util
public class Util
Constructor Summary | |
---|---|
Util()
|
Method Summary | |
---|---|
static TernaryPolynomial |
generateRandomTernary(int N,
int numOnes,
int numNegOnes,
boolean sparse,
java.security.SecureRandom random)
Generates a "sparse" or "dense" polynomial containing numOnes ints equal to 1, numNegOnes int equal to -1, and the rest equal to 0. |
static int[] |
generateRandomTernary(int N,
int numOnes,
int numNegOnes,
java.security.SecureRandom random)
Generates an array containing numOnes ints equal to 1, numNegOnes int equal to -1, and the rest equal to 0. |
static int |
invert(int n,
int modulus)
Calculates the inverse of n mod modulus |
static boolean |
is64BitJVM()
Takes an educated guess as to whether 64 bits are supported by the JVM. |
static int |
pow(int a,
int b,
int modulus)
Calculates a^b mod modulus |
static long |
pow(long a,
int b,
long modulus)
Calculates a^b mod modulus |
static byte[] |
readFullLength(java.io.InputStream is,
int length)
Reads a given number of bytes from an InputStream . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static int invert(int n, int modulus)
public static int pow(int a, int b, int modulus)
public static long pow(long a, int b, long modulus)
public static TernaryPolynomial generateRandomTernary(int N, int numOnes, int numNegOnes, boolean sparse, java.security.SecureRandom random)
N
- numOnes
- numNegOnes
- sparse
- whether to create a SparseTernaryPolynomial
or DenseTernaryPolynomial
public static int[] generateRandomTernary(int N, int numOnes, int numNegOnes, java.security.SecureRandom random)
N
- numOnes
- numNegOnes
-
public static boolean is64BitJVM()
true
if 64-bit support detected, false
otherwisepublic static byte[] readFullLength(java.io.InputStream is, int length) throws java.io.IOException
InputStream
.
If there are not enough bytes in the stream, an IOException
is thrown.
is
- length
-
length
java.io.IOException
|
Bouncy Castle Cryptography Library 1.49 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |