diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-02-27 13:01:12 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-02-27 13:01:12 +0700 |
commit | 5e1ef1cb46ed4967423d16805b9ac780c4ba9599 (patch) | |
tree | 3002a808a4d7c745e0316b0a8b2f3a2946bec0b6 /crypto/src/math/ec/custom/sec/SecP521R1FieldElement.cs | |
parent | Optimize Sqrt() for custom secp384r1 (diff) | |
download | BouncyCastle.NET-ed25519-5e1ef1cb46ed4967423d16805b9ac780c4ba9599.tar.xz |
Equality/hashcode should ignore "excess" words
Diffstat (limited to '')
-rw-r--r-- | crypto/src/math/ec/custom/sec/SecP521R1FieldElement.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecP521R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP521R1FieldElement.cs index e47a199f3..83a615928 100644 --- a/crypto/src/math/ec/custom/sec/SecP521R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP521R1FieldElement.cs @@ -136,7 +136,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec SecP521R1Field.SquareN(x1, 519, t1); SecP521R1Field.Square(t1, t2); - return Arrays.AreEqual(x1, t2) ? new SecP521R1FieldElement(t1) : null; + return Nat.Eq(17, x1, t2) ? new SecP521R1FieldElement(t1) : null; } public override bool Equals(object obj) @@ -155,12 +155,12 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return true; if (null == other) return false; - return Arrays.AreEqual(x, other.x); + return Nat.Eq(17, x, other.x); } public override int GetHashCode() { - return Q.GetHashCode() ^ Arrays.GetHashCode(x); + return Q.GetHashCode() ^ Arrays.GetHashCode(x, 0, 17); } } } |