|
Bouncy Castle Cryptography Library 1.87 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.bouncycastle.pqc.crypto.ntruprime.UtilsTest
Tests for the arithmetic in NTRU Prime's 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 Summary | |
UtilsTest()
|
|
| Method Summary | |
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()
|
| Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString |
| Methods inherited from class junit.framework.Assert |
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, fail, fail |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public UtilsTest()
| Method Detail |
public 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()
|
Bouncy Castle Cryptography Library 1.87 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||