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/Nat256.cs | |
parent | Optimize Sqrt() for custom secp384r1 (diff) | |
download | BouncyCastle.NET-ed25519-5e1ef1cb46ed4967423d16805b9ac780c4ba9599.tar.xz |
Equality/hashcode should ignore "excess" words
Diffstat (limited to 'crypto/src/math/ec/custom/sec/Nat256.cs')
-rw-r--r-- | crypto/src/math/ec/custom/sec/Nat256.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crypto/src/math/ec/custom/sec/Nat256.cs b/crypto/src/math/ec/custom/sec/Nat256.cs index aa6f4e5eb..98b4b83cd 100644 --- a/crypto/src/math/ec/custom/sec/Nat256.cs +++ b/crypto/src/math/ec/custom/sec/Nat256.cs @@ -303,6 +303,16 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return pos; } + public static bool Eq(uint[] x, uint[] y) + { + for (int i = 7; i >= 0; --i) + { + if (x[i] != y[i]) + return false; + } + return true; + } + public static uint[] FromBigInteger(BigInteger x) { if (x.SignValue < 0 || x.BitLength > 256) |