import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public static String PasswordEncript(String password) { BASE64Encoder b64e = new BASE64Encoder(); MessageDigest md; String md5Passwd = null; try { md = MessageDigest.getInstance( "MD5" ); md.update( password.getBytes() ); byte [] raw = md.digest(); System.out.println( "MessageDigest : +" + raw + "+" ); md5Passwd = b64e.encode( raw ); System.out.println( "Base64Encode : +" + md5Passwd + "+" ); } catch ( NoSuchAlgorithmException e ) { e.printStackTrace(); md5Passwd = null; } return md5Passwd; }
JAVA용 md5 해싱 함수입니다.