summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crypto/src/crypto/digests/GeneralDigest.cs2
-rw-r--r--crypto/src/crypto/digests/LongDigest.cs4
2 files changed, 3 insertions, 3 deletions
diff --git a/crypto/src/crypto/digests/GeneralDigest.cs b/crypto/src/crypto/digests/GeneralDigest.cs
index d40ad28bb..c38b35fd3 100644
--- a/crypto/src/crypto/digests/GeneralDigest.cs
+++ b/crypto/src/crypto/digests/GeneralDigest.cs
@@ -78,7 +78,7 @@ namespace Org.BouncyCastle.Crypto.Digests
             //
             // process whole words.
             //
-            int limit = ((length - i) & ~3) + i;
+            int limit = length - 3;
             for (; i < limit; i += 4)
             {
                 ProcessWord(input, inOff + i);
diff --git a/crypto/src/crypto/digests/LongDigest.cs b/crypto/src/crypto/digests/LongDigest.cs
index 9ee9bcd57..aaa0b43ce 100644
--- a/crypto/src/crypto/digests/LongDigest.cs
+++ b/crypto/src/crypto/digests/LongDigest.cs
@@ -102,7 +102,7 @@ namespace Org.BouncyCastle.Crypto.Digests
             //
             // process whole words.
             //
-            while (length > xBuf.Length)
+            while (length >= xBuf.Length)
             {
                 ProcessWord(input, inOff);
 
@@ -172,7 +172,7 @@ namespace Org.BouncyCastle.Crypto.Digests
             }
         }
 
-		/**
+        /**
         * adjust the byte counts so that byteCount2 represents the
         * upper long (less 3 bits) word of the byte count.
         */