|
|
@@ -1,5 +1,6 @@ |
|
|
|
import java.io.*; |
|
|
|
import java.math.BigInteger; |
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
import java.security.MessageDigest; |
|
|
|
import java.security.NoSuchAlgorithmException; |
|
|
|
import java.util.ArrayList; |
|
|
@@ -42,11 +43,11 @@ public class Helpers { |
|
|
|
// Rückgabe als Hex-Zeichenkette |
|
|
|
public static String getHash(String w) { |
|
|
|
try { |
|
|
|
byte[] bytesOfMessage = w.getBytes("UTF-8"); |
|
|
|
byte[] bytesOfMessage = w.getBytes(StandardCharsets.UTF_8); |
|
|
|
MessageDigest md = MessageDigest.getInstance("MD5"); |
|
|
|
byte[] thedigest = md.digest(bytesOfMessage); |
|
|
|
return String.format("%032x", new BigInteger(1, thedigest)); |
|
|
|
} catch (UnsupportedEncodingException | NoSuchAlgorithmException e) { |
|
|
|
} catch (NoSuchAlgorithmException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
return null; |