From d21c219c4985a75204048ce03cf80ffd65765bf5 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Tue, 25 Oct 2022 17:16:51 +0700 Subject: Xor methods in Nat classes --- crypto/src/pqc/crypto/bike/BikeRing.cs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'crypto/src/pqc') 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; } -- cgit 1.4.1