diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-12-28 14:59:52 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-12-28 14:59:52 +0700 |
commit | 125e93ac90fab535316f55695f14dde8e9c76c97 (patch) | |
tree | 2dff432202163117d5012448b977c87c6f44a218 /crypto/test | |
parent | XML doc for TlsClient.ClientHelloRecordLayerVersion (diff) | |
download | BouncyCastle.NET-ed25519-125e93ac90fab535316f55695f14dde8e9c76c97.tar.xz |
Optimized Sqrt and Trace for custom binary curves
Diffstat (limited to 'crypto/test')
-rw-r--r-- | crypto/test/src/math/ec/test/ECPointTest.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crypto/test/src/math/ec/test/ECPointTest.cs b/crypto/test/src/math/ec/test/ECPointTest.cs index 3c10170f7..57f838f9f 100644 --- a/crypto/test/src/math/ec/test/ECPointTest.cs +++ b/crypto/test/src/math/ec/test/ECPointTest.cs @@ -437,6 +437,19 @@ namespace Org.BouncyCastle.Math.EC.Tests } } } + else if (ECAlgorithms.IsF2mCurve(c)) + { + int m = c.FieldSize; + BigInteger x = new BigInteger(m, secRand); + ECFieldElement fe = c.FromBigInteger(x); + for (int i = 0; i < 100; ++i) + { + ECFieldElement sq = fe.Square(); + ECFieldElement check = sq.Sqrt(); + Assert.AreEqual(fe, check); + fe = sq; + } + } } private void ImplAddSubtractMultiplyTwiceEncodingTestAllCoords(X9ECParameters x9ECParameters) |