11package org .bouncycastle .crypto .digests ;
22
3- import org .bouncycastle .crypto .*;
3+ import org .bouncycastle .crypto .CipherParameters ;
4+ import org .bouncycastle .crypto .CryptoServicePurpose ;
5+ import org .bouncycastle .crypto .CryptoServicesRegistrar ;
6+ import org .bouncycastle .crypto .ExtendedDigest ;
7+ import org .bouncycastle .crypto .Xof ;
48import org .bouncycastle .util .Arrays ;
59import org .bouncycastle .util .Bytes ;
610import org .bouncycastle .util .Pack ;
@@ -220,8 +224,6 @@ abstract static class KangarooBase
220224 */
221225 private int theProcessed ;
222226
223- private final CryptoServicePurpose purpose ;
224-
225227 /**
226228 * Constructor.
227229 *
@@ -241,7 +243,6 @@ abstract static class KangarooBase
241243
242244 /* Build personalisation */
243245 buildPersonal (null );
244- this .purpose = purpose ;
245246
246247 CryptoServicesRegistrar .checkConstraints (Utils .getDefaultProperties (this , pStrength , purpose ));
247248
@@ -542,7 +543,7 @@ private static class KangarooSponge
542543 /**
543544 * The round constants.
544545 */
545- private static long [] KeccakRoundConstants = new long []{0x0000000000000001L , 0x0000000000008082L ,
546+ private static final long [] KeccakRoundConstants = new long []{0x0000000000000001L , 0x0000000000008082L ,
546547 0x800000000000808aL , 0x8000000080008000L , 0x000000000000808bL , 0x0000000080000001L , 0x8000000080008081L ,
547548 0x8000000000008009L , 0x000000000000008aL , 0x0000000000000088L , 0x0000000080008009L , 0x000000008000000aL ,
548549 0x000000008000808bL , 0x800000000000008bL , 0x8000000000008089L , 0x8000000000008003L , 0x8000000000008002L ,
@@ -625,6 +626,12 @@ private void absorb(final byte[] data,
625626 int count = 0 ;
626627 while (count < len )
627628 {
629+ if (bytesInQueue == theRateBytes )
630+ {
631+ KangarooAbsorb (theQueue , 0 );
632+ bytesInQueue = 0 ;
633+ }
634+
628635 if (bytesInQueue == 0 && count <= (len - theRateBytes ))
629636 {
630637 do
@@ -642,12 +649,6 @@ private void absorb(final byte[] data,
642649
643650 bytesInQueue += partialBlock ;
644651 count += partialBlock ;
645-
646- if (bytesInQueue == theRateBytes )
647- {
648- KangarooAbsorb (theQueue , 0 );
649- bytesInQueue = 0 ;
650- }
651652 }
652653 }
653654 }
0 commit comments