Skip to content

Commit

Permalink
make DigestTools package-private
Browse files Browse the repository at this point in the history
  • Loading branch information
aburgd committed Jul 24, 2017
1 parent 9817944 commit f22e8ea
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/DigestTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class DigestTools {
class DigestTools {
static byte[] getDigest(BigInteger bigIntValue, String...
instanceAlgo) {
if (instanceAlgo[1].isEmpty()) instanceAlgo[1] = "SHA-256";
if (instanceAlgo[0].isEmpty()) instanceAlgo[0] = "SHA-256";
String biString = bigIntValue.toString();
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance(instanceAlgo[1]);
digest = MessageDigest.getInstance(instanceAlgo[0]);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return digest.digest(biString.getBytes(StandardCharsets
.UTF_8));
}

public static void digestPrinter(String digestHex) {
static void digestPrinter(String digestHex) {
// left padding for odd-length strings
if (digestHex.length() % 2 != 0) digestHex = " " + digestHex;
for (int i = 0; i < digestHex.length(); i += 2) {
Expand Down

0 comments on commit f22e8ea

Please sign in to comment.