개요[ | ]
- HR자바 Java MD5
Java
Copy
import java.io.*;
import java.util.*;
public class Solution {
static String md5(String s) {
java.security.MessageDigest md;
try { md = java.security.MessageDigest.getInstance("MD5"); }
catch (Exception e) { return null; }
md.update(s.getBytes());
String result = (new java.math.BigInteger(1, md.digest())).toString(16);
while(result.length()<32) { result = "0" + result; }
return result;
}
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 sc = new Scanner(System.in);
String str = sc.next();
System.out.println( md5(str) );
}
}
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.