Commit6
This commit is contained in:
parent
89eaca21cf
commit
e43ae56c3e
BIN
out/production/PROG3PASSWORT/Helpers.class
Normal file
BIN
out/production/PROG3PASSWORT/Helpers.class
Normal file
Binary file not shown.
BIN
out/production/PROG3PASSWORT/Main.class
Normal file
BIN
out/production/PROG3PASSWORT/Main.class
Normal file
Binary file not shown.
4
out/production/PROG3PASSWORT/passwd.txt
Normal file
4
out/production/PROG3PASSWORT/passwd.txt
Normal file
@ -0,0 +1,4 @@
|
||||
hofmannol
|
||||
2df372ddeafdf65908ddda48799d6f21
|
||||
wimmerma
|
||||
eb9b41a390c3a252aff0454e8df16f75
|
@ -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;
|
||||
|
@ -6,7 +6,7 @@ public class Main {
|
||||
// String login = s.next();
|
||||
// System.out.println("Passwort:");
|
||||
// String pwd = s.next();
|
||||
// s. close();
|
||||
s. close();
|
||||
|
||||
Helpers.readTextdatei("src/passwd.txt");
|
||||
Helpers.writeTextdatei("src/passwd.txt", Helpers.readTextdatei("src/passwd.txt"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user