Skip to content

Commit

Permalink
early JVM compatibility, minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
dghgit committed Feb 22, 2021
1 parent ad81ca2 commit d145016
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
18 changes: 9 additions & 9 deletions core/src/main/java/org/bouncycastle/crypto/digests/Kangaroo.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package org.bouncycastle.crypto.digests;

import org.bouncycastle.crypto.CipherParameters;
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.ExtendedDigest;
import org.bouncycastle.crypto.Xof;
import org.bouncycastle.util.Arrays;
import org.bouncycastle.util.Bytes;
import org.bouncycastle.util.Pack;

/**
* Kangaroo.
*/
public abstract class Kangaroo
implements Digest
public final class Kangaroo
{
/**
* Default digest length.
Expand Down Expand Up @@ -42,7 +42,7 @@ public KangarooTwelve(final int pLength)

public String getAlgorithmName()
{
return getClass().getSimpleName();
return "KangarooTwelve";
}
}

Expand Down Expand Up @@ -71,7 +71,7 @@ public MarsupilamiFourteen(final int pLength)

public String getAlgorithmName()
{
return getClass().getSimpleName();
return "MarsupilamiFourteen";
}
}

Expand Down Expand Up @@ -171,8 +171,8 @@ public KangarooParameters build()
/**
* The Kangaroo Base.
*/
public abstract static class KangarooBase
implements Digest, Xof
abstract static class KangarooBase
implements ExtendedDigest, Xof
{
/**
* Block Size.
Expand Down Expand Up @@ -561,7 +561,7 @@ private static byte[] lengthEncode(final long strLen)
if (v != 0)
{
n = 1;
while ((v >>= Byte.SIZE) != 0)
while ((v >>= Bytes.SIZE) != 0)
{
n++;
}
Expand All @@ -574,7 +574,7 @@ private static byte[] lengthEncode(final long strLen)
/* Encode the length */
for (int i = 0; i < n; i++)
{
b[i] = (byte) (strLen >> (Byte.SIZE * (n - i - 1)));
b[i] = (byte) (strLen >> (Bytes.SIZE * (n - i - 1)));
}

/* Return the encoded length */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ public class RegressionTest
new KMACTest(),
new SipHash128Test(),
new GCMSIVTest(),
new Blake3Test()
new Blake3Test(),
new KangarooTest()
};

public static void main(String[] args)
Expand Down

0 comments on commit d145016

Please sign in to comment.