public class UtilsTest
extends junit.framework.TestCase
Utils.
The polynomial products are computed by Karatsuba in int arithmetic and reduced once per coefficient, and getModFreeze() is a multiply-shift reduction, where both used to reduce every partial sum through a division routine. The KATs only reach the inputs their seeds produce, so these tests compare the arithmetic with a plain reference - a schoolbook product in long arithmetic and the % operator - for every parameter set, including the largest operands the callers can pass, which are what the int arithmetic's bounds depend on.
| Constructor and Description |
|---|
UtilsTest() |
| Modifier and Type | Method and Description |
|---|---|
void |
testCiphertextDiffMask() |
void |
testDecodeTruncated()
A truncated encoding is rejected rather than decoded with the missing bytes taken as anything.
|
void |
testEncodeDecode()
Decoding agrees with the reference's Decode, read with unsigned bytes and long arithmetic, for random byte
strings, which are mostly non-canonical encodings holding larger bytes than a valid one can, and for valid
encodings; encoding agrees with the reference's Encode.
|
void |
testInverseInRQ() |
void |
testInvertiblePolynomialInR3() |
void |
testModFreeze() |
void |
testMultiplicationInR3() |
void |
testMultiplicationInRQ() |
void |
testOneThirdInverseInRQ() |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toStringpublic void testModFreeze()
public void testMultiplicationInRQ()
public void testMultiplicationInR3()
public void testInverseInRQ()
public void testOneThirdInverseInRQ()
public void testInvertiblePolynomialInR3()
public void testCiphertextDiffMask()
public void testEncodeDecode()
public void testDecodeTruncated()