diff --git a/tests/t_finite_fields_powinv.nim b/tests/t_finite_fields_powinv.nim index d31e1cf82..4d67fa564 100644 --- a/tests/t_finite_fields_powinv.nim +++ b/tests/t_finite_fields_powinv.nim @@ -294,4 +294,13 @@ proc main() = testRandomInv BLS12_461 testRandomInv BN462 + suite "Bug highlighted by property-based testing" & " [" & $WordBitwidth & "-bit mode]": + test "#30 - Euler's Criterion should be 1 for square on FKM12_447": + var a: Fp[FKM12_447] + # square of "0x406e5e74ee09c84fa0c59f2db3ac814a4937e2f57ecd3c0af4265e04598d643c5b772a6549a2d9b825445c34b8ba100fe8d912e61cfda43d" + a.fromHex("0x1e6511b2bfabd7d32d8df7492c66df29ade7fdb21bb0d8f6cacfccb05e45a812a27cd087e1bbb2d202ee29f75a021a6a68d990a2a5e73410") + + a.powUnsafeExponent(FKM12_447.getPrimeMinus1div2_BE()) + check: bool a.isOne() + main() diff --git a/tests/t_finite_fields_sqrt.nim b/tests/t_finite_fields_sqrt.nim index c427729df..a79c1d322 100644 --- a/tests/t_finite_fields_sqrt.nim +++ b/tests/t_finite_fields_sqrt.nim @@ -133,4 +133,11 @@ proc main() = randomSqrtCheck_p3mod4 BLS12_461 randomSqrtCheck_p3mod4 BN462 + suite "Modular square root - 32-bit bugs highlighted by property-based testing " & " [" & $WordBitwidth & "-bit mode]": + test "FKM12_447 - #30": + var a: Fp[FKM12_447] + a.fromHex("0x406e5e74ee09c84fa0c59f2db3ac814a4937e2f57ecd3c0af4265e04598d643c5b772a6549a2d9b825445c34b8ba100fe8d912e61cfda43d") + a.square() + check: bool a.isSquare() + main()