-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathjava MD5.java
More file actions
25 lines (21 loc) · 751 Bytes
/
Copy pathjava MD5.java
File metadata and controls
25 lines (21 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.io.*;
import java.security.MessageDigest;
import java.nio.charset.Charset;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner in = new Scanner(System.in);
String message = in.nextLine();
in.close();
try {
MessageDigest messageDigest
= MessageDigest.getInstance("MD5");
messageDigest.update(message.getBytes());
byte[] hash = messageDigest.digest();
for (byte b : hash) {
System.out.printf("%02x", b);
}
} catch (Exception e) {}
}
}