Labels

algorithms (22) Design Patterns (20) java (19) linux (14) Snippet (13) service mix (6) soa (4)

MD5 Encryption

public static byte[] getEncrypted(String passwd) {

     try {

         MessageDigest md = MessageDigest.getInstance("MD5");

         byte[] pwd = passwd.getBytes();

         md.update(pwd);

         byte[] mdpwd = md.digest();

         return mdpwd;

         }

     catch (NoSuchAlgorithmException e) {

         e.printStackTrace();

     }

     return null;

}

1 comment:

  1. Great tip in case you want to encrypt the data. It's about using the proper code.

    ReplyDelete

Search 24 Bytes

Loading...