DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Java - String2MD5

02.28.2007
| 7966 views |
  • submit to reddit
        
public static byte[] getKeyedDigest(byte[] buffer, byte[] key) {
   try {
      MessageDigest md5 = MessageDigest.getInstance("MD5");
      md5.update(buffer);
      return md5.digest(key);
   } catch (NoSuchAlgorithmException nsae) {}

   return null;
}