summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-07-24 23:46:40 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-07-24 23:46:40 +0700
commit223fd5527a52e786d9f2be5a213934ffda42a89e (patch)
tree8f9c34c14408303e39c4bbe83459ff429a683bd3
parentFormatting (diff)
downloadBouncyCastle.NET-ed25519-223fd5527a52e786d9f2be5a213934ffda42a89e.tar.xz
Digest tweaks
-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.
         */