From 223fd5527a52e786d9f2be5a213934ffda42a89e Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Sun, 24 Jul 2022 23:46:40 +0700 Subject: Digest tweaks --- crypto/src/crypto/digests/GeneralDigest.cs | 2 +- crypto/src/crypto/digests/LongDigest.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crypto') 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. */ -- cgit 1.5.1