Added stringToBytes convertion

This commit is contained in:
Marcin Kostrzewski 2020-10-29 15:36:44 +01:00
parent 04551f1528
commit a8dcd6e9fd

View File

@ -1,5 +1,7 @@
package Main;
import java.math.BigInteger;
public class Utils {
static String bytesToHex(byte[] hash) {
StringBuilder hexString = new StringBuilder(2 * hash.length);
@ -12,4 +14,8 @@ public class Utils {
}
return hexString.toString();
}
static byte[] stringToBytes(String hexString) {
return new BigInteger(hexString, 16).toByteArray();
}
}