From 95b973942745d7f129c5715ab99dec8c445c804f Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Sat, 25 Jan 2014 20:48:13 +0700 Subject: Change F2m test curve to match Java version more clearly --- crypto/test/src/math/ec/test/ECPointTest.cs | 32 +++++++++++++---------------- 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'crypto/test') diff --git a/crypto/test/src/math/ec/test/ECPointTest.cs b/crypto/test/src/math/ec/test/ECPointTest.cs index faaca7f19..2bf1bb97e 100644 --- a/crypto/test/src/math/ec/test/ECPointTest.cs +++ b/crypto/test/src/math/ec/test/ECPointTest.cs @@ -51,7 +51,7 @@ namespace Org.BouncyCastle.Math.EC.Tests /** * Creates the points on the curve with literature values. */ - internal static void createPoints() + internal static void CreatePoints() { for (int i = 0; i < pointSource.Length / 2; i++) { @@ -73,34 +73,30 @@ namespace Org.BouncyCastle.Math.EC.Tests internal const int k1 = 1; // a = z^3 - internal static readonly F2mFieldElement aTpb = new F2mFieldElement(m, k1, - new BigInteger("8", 16)); + internal static readonly BigInteger aTpb = new BigInteger("1000", 2); // b = z^3 + 1 - internal static readonly F2mFieldElement bTpb = new F2mFieldElement(m, k1, - new BigInteger("9", 16)); + internal static readonly BigInteger bTpb = new BigInteger("1001", 2); - internal static readonly F2mCurve curve = new F2mCurve(m, k1, aTpb - .ToBigInteger(), bTpb.ToBigInteger()); + internal static readonly F2mCurve curve = new F2mCurve(m, k1, aTpb, bTpb); - internal static readonly F2mPoint infinity = (F2mPoint) curve.Infinity; + internal static readonly F2mPoint infinity = (F2mPoint)curve.Infinity; - internal static readonly string[] pointSource = { "2", "f", "c", "c", "1", "1", "b", "2" }; + internal static readonly String[] pointSource = { "0010", "1111", "1100", "1100", + "0001", "0001", "1011", "0010" }; - internal static F2mPoint[] p = new F2mPoint[pointSource.Length / 2]; + internal static readonly ECPoint[] p = new ECPoint[pointSource.Length / 2]; /** * Creates the points on the curve with literature values. */ - internal static void createPoints() + internal static void CreatePoints() { for (int i = 0; i < pointSource.Length / 2; i++) { - F2mFieldElement x = new F2mFieldElement(m, k1, - new BigInteger(pointSource[2 * i], 16)); - F2mFieldElement y = new F2mFieldElement(m, k1, - new BigInteger(pointSource[2 * i + 1], 16)); - p[i] = new F2mPoint(curve, x, y); + p[i] = curve.CreatePoint( + new BigInteger(pointSource[2 * i], 2), + new BigInteger(pointSource[2 * i + 1], 2)); } } } @@ -109,10 +105,10 @@ namespace Org.BouncyCastle.Math.EC.Tests public void setUp() { // fp = new ECPointTest.Fp(); - Fp.createPoints(); + Fp.CreatePoints(); // f2m = new ECPointTest.F2m(); - F2m.createPoints(); + F2m.CreatePoints(); } /** -- cgit 1.4.1