From 0d74a23f78cc18401b5f746a97faf1f43003655f Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Tue, 21 Jan 2014 16:19:11 +0700 Subject: Add new classes in Math.Field and some other EC-related stuff from Java --- crypto/src/math/field/PrimeField.cs | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 crypto/src/math/field/PrimeField.cs (limited to 'crypto/src/math/field/PrimeField.cs') diff --git a/crypto/src/math/field/PrimeField.cs b/crypto/src/math/field/PrimeField.cs new file mode 100644 index 000000000..f6ba629d5 --- /dev/null +++ b/crypto/src/math/field/PrimeField.cs @@ -0,0 +1,44 @@ +using System; + +namespace Org.BouncyCastle.Math.Field +{ + internal class PrimeField + : IFiniteField + { + protected readonly BigInteger characteristic; + + internal PrimeField(BigInteger characteristic) + { + this.characteristic = characteristic; + } + + public virtual BigInteger Characteristic + { + get { return characteristic; } + } + + public virtual int Dimension + { + get { return 1; } + } + + public override bool Equals(object obj) + { + if (this == obj) + { + return true; + } + PrimeField other = obj as PrimeField; + if (null == other) + { + return false; + } + return characteristic.Equals(other.characteristic); + } + + public override int GetHashCode() + { + return characteristic.GetHashCode(); + } + } +} -- cgit 1.5.1