- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
Latest commit
25 lines (20 loc) · 711 Bytes
/
Copy pathSolution.java
File metadata and controls
25 lines (20 loc) · 711 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
importjava.io.*;
importjava.util.*;
importjava.security.MessageDigest;
importjava.security.NoSuchAlgorithmException;
publicclassSolution {
publicstaticvoidmain(String[] args) throwsNoSuchAlgorithmException {
/* Read and save the input String */
Scannerscan = newScanner(System.in);
Stringstr = scan.next();
scan.close();
/* Encode the String using MD5 */
MessageDigestmd = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte[] digest = md.digest();
/* Print the encoded value in hexadecimal */
for (byteb : digest) {
System.out.format("%02x", b);
}
}
}