-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathSolution.java
More file actions
27 lines (24 loc) · 735 Bytes
/
Solution.java
File metadata and controls
27 lines (24 loc) · 735 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
26
27
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.security.MessageDigest;
public class Solution {
private static String convertByteToHex(byte[] byteData) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < byteData.length; i++) {
sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1));
}
return sb.toString();
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String word = sc.next();
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
System.out.println(convertByteToHex(md.digest(word.getBytes())));
} catch (Exception e) { }
}
}