1 개요[ | ]
- Java md5()
- 자바 md5()
Java
Copy
public class MyClass {
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[]) {
System.out.println(md5(""));
// d41d8cd98f00b204e9800998ecf8427e
System.out.println(md5("hello33"));
// 005529451481309d2b8f708bbb81ea41
System.out.println(md5("hello world"));
// 5eb63bbbe01eeed093cb22bb8f5acdc3
}
}
2 같이 보기[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.
- 분류 댓글:
- Java (3)
Java 튜토리얼 웹사이트 ― Thesmolt젠킨스 ― John Jeong젠킨스 ― Icesky