How to clac MD5 ?
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(s.getBytes());
byte[] messageDigest = digest.digest();
StringBuffer hexString = new StringBuffer();
for(int i = 0 ; i < messageDigest.length ; i++)
hexString.append(Integer.toHexString(0xFF & messageDigest[i]));
return hexString.toString();
No comments:
Post a Comment