From a0b7d3b1174a6088049e360a45db4e0c1a04b32a Mon Sep 17 00:00:00 2001 From: David Hook Date: Tue, 27 Jun 2017 11:09:59 +1000 Subject: paddingfix for where pad block extends over 2 block boundary. --- crypto/src/crypto/digests/DSTU7564Digest.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'crypto/src') diff --git a/crypto/src/crypto/digests/DSTU7564Digest.cs b/crypto/src/crypto/digests/DSTU7564Digest.cs index 9a785a5c9..12057b146 100644 --- a/crypto/src/crypto/digests/DSTU7564Digest.cs +++ b/crypto/src/crypto/digests/DSTU7564Digest.cs @@ -212,12 +212,20 @@ namespace Org.BouncyCastle.Crypto.Digests { padded_ = Pad(buf, 0, bufOff); - ProcessBlock(padded_, 0); + int paddedLen = padded_.Length; + int paddedOff = 0; - - //Console.WriteLine(stateLine.Length); + while (paddedLen != 0) + { + ProcessBlock(padded_, paddedOff); + paddedOff += blockSize; + paddedLen -= blockSize; + } + + + //Console.WriteLine(stateLine.Length); - byte[][] temp = new byte[STATE_BYTE_SIZE_1024][]; + byte[][] temp = new byte[STATE_BYTE_SIZE_1024][]; for (int i = 0; i < state_.Length; i++) { temp[i] = new byte[ROWS]; -- cgit 1.5.1