diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2018-09-25 21:47:28 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2018-09-25 21:47:28 +0700 |
commit | 7951b6781f03204652fd7a6ff023732b010ebd59 (patch) | |
tree | c854ba920f600ddf6aa7ed41bd06708a9e425c88 /crypto/src/util/Integers.cs | |
parent | Fix ed25519 ignoring the public key offset (diff) | |
download | BouncyCastle.NET-ed25519-7951b6781f03204652fd7a6ff023732b010ebd59.tar.xz |
Port of SM4 from Java API
Diffstat (limited to 'crypto/src/util/Integers.cs')
-rw-r--r-- | crypto/src/util/Integers.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/src/util/Integers.cs b/crypto/src/util/Integers.cs index ccbf872c4..e746b0ef4 100644 --- a/crypto/src/util/Integers.cs +++ b/crypto/src/util/Integers.cs @@ -9,9 +9,21 @@ namespace Org.BouncyCastle.Utilities return (i << distance) ^ (int)((uint)i >> -distance); } + [CLSCompliantAttribute(false)] + public static uint RotateLeft(uint i, int distance) + { + return (i << distance) ^ (i >> -distance); + } + public static int RotateRight(int i, int distance) { return (int)((uint)i >> distance) ^ (i << -distance); } + + [CLSCompliantAttribute(false)] + public static uint RotateRight(uint i, int distance) + { + return (i >> distance) ^ (i << -distance); + } } } |