diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-03-02 22:40:06 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-03-02 22:40:06 +0700 |
commit | 3fe6af3940d17c6a8c7d69c322497fb1c3d5ef1a (patch) | |
tree | 342282cf4603b9b9f6e63db49eb1f0300cbdce2b | |
parent | Use existing KeccakPermutation (diff) | |
download | BouncyCastle.NET-ed25519-3fe6af3940d17c6a8c7d69c322497fb1c3d5ef1a.tar.xz |
Add ShiftDownBits64
-rw-r--r-- | crypto/src/math/raw/Nat.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crypto/src/math/raw/Nat.cs b/crypto/src/math/raw/Nat.cs index 1d08b6d92..61d060b4e 100644 --- a/crypto/src/math/raw/Nat.cs +++ b/crypto/src/math/raw/Nat.cs @@ -1582,6 +1582,19 @@ namespace Org.BouncyCastle.Math.Raw } #endif + public static ulong ShiftDownBits64(int len, ulong[] z, int zOff, int bits, ulong c) + { + Debug.Assert(bits > 0 && bits < 64); + int i = len; + while (--i >= 0) + { + ulong next = z[zOff + i]; + z[zOff + i] = (next >> bits) | (c << -bits); + c = next; + } + return c << -bits; + } + public static uint ShiftDownWord(int len, uint[] z, uint c) { int i = len; |