summary refs log tree commit diff
path: root/crypto/src/util
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-01-21 16:19:11 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-01-21 16:19:11 +0700
commit0d74a23f78cc18401b5f746a97faf1f43003655f (patch)
treea4aee2333d364a49b947f371924d2e5d3bc53bd6 /crypto/src/util
parentUse ECCurve.CreatePoint (diff)
downloadBouncyCastle.NET-ed25519-0d74a23f78cc18401b5f746a97faf1f43003655f.tar.xz
Add new classes in Math.Field and some other EC-related stuff from Java
Diffstat (limited to 'crypto/src/util')
-rw-r--r--crypto/src/util/Integers.cs17
1 files changed, 17 insertions, 0 deletions
diff --git a/crypto/src/util/Integers.cs b/crypto/src/util/Integers.cs
new file mode 100644

index 000000000..ccbf872c4 --- /dev/null +++ b/crypto/src/util/Integers.cs
@@ -0,0 +1,17 @@ +using System; + +namespace Org.BouncyCastle.Utilities +{ + public abstract class Integers + { + public static int RotateLeft(int i, int distance) + { + return (i << distance) ^ (int)((uint)i >> -distance); + } + + public static int RotateRight(int i, int distance) + { + return (int)((uint)i >> distance) ^ (i << -distance); + } + } +}