diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-25 17:16:51 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-25 17:16:51 +0700 |
commit | d21c219c4985a75204048ce03cf80ffd65765bf5 (patch) | |
tree | 2e0f21eb3b0f1583f64b6bd662c3b44de60c3053 /crypto/src/pqc | |
parent | Fixed pqc/utils (diff) | |
download | BouncyCastle.NET-ed25519-d21c219c4985a75204048ce03cf80ffd65765bf5.tar.xz |
Xor methods in Nat classes
Diffstat (limited to 'crypto/src/pqc')
-rw-r--r-- | crypto/src/pqc/crypto/bike/BikeRing.cs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/crypto/src/pqc/crypto/bike/BikeRing.cs b/crypto/src/pqc/crypto/bike/BikeRing.cs index c2b2102b8..9d317fa4b 100644 --- a/crypto/src/pqc/crypto/bike/BikeRing.cs +++ b/crypto/src/pqc/crypto/bike/BikeRing.cs @@ -30,10 +30,12 @@ namespace Org.BouncyCastle.Pqc.Crypto.Bike internal void Add(ulong[] x, ulong[] y, ulong[] z) { - for (int i = 0; i < Size; ++i) - { - z[i] = x[i] ^ y[i]; - } + Nat.Xor64(Size, x, y, z); + } + + internal void AddTo(ulong[] x, ulong[] z) + { + Nat.XorTo64(Size, x, z); } internal void Copy(ulong[] x, ulong[] z) @@ -170,12 +172,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Bike ulong c = Nat.ShiftUpBits64(Size, tt, Size, excessBits, tt[Size - 1], z, 0); Debug.Assert(c == 0UL); - - for (int i = 0; i < Size; ++i) - { - z[i] ^= tt[i]; - } - + AddTo(tt, z); z[Size - 1] &= partialMask; } |