/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.helper.security;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 *
 */
public class PasswordEncrypter {

    private static String encryptionAlgorithm="MD5";
    private static MessageDigest messageDigester;

    public static String getEncryptedPassword(char[] inp_password) {
        String uncrypted_password = new String(inp_password);
        String encryptedPassword;
        encryptedPassword = getEncryptedPassword(uncrypted_password);
        return encryptedPassword;
    }

    public static String getEncryptedPassword(String inp_password) {
        String encryptedPassword;
        try {
            messageDigester = MessageDigest.getInstance(encryptionAlgorithm);
            byte[] passwordBytes = inp_password.getBytes();
            messageDigester.reset();
            byte[] digestedBytes = messageDigester.digest(passwordBytes);
            StringBuilder encryptedPasswordBuilder = new StringBuilder();
            
            for (int i = 0; i < digestedBytes.length; i++) {
                encryptedPasswordBuilder.append(Integer.toHexString(0xff & digestedBytes[i]));
            }
            encryptedPassword=encryptedPasswordBuilder.toString();
            return encryptedPassword;
        } catch (NoSuchAlgorithmException ex) {
            Logger.getLogger(PasswordEncrypter.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;

    }
}

@@ -795,32 +795,232 @@
 ryptedPassword;%0A
+        encryptedPassword = encrypPassword(inp_password);%0A        return encryptedPassword;%0A    %7D%0A    %0A    private static String encrypPassword(String inp_password)%7B%0A        String encryptedPassword;%0A
         try %7B%0A  
@@ -1800,17 +1800,16 @@
 n null;%0A
-%0A
     %7D%0A%7D%0A

Update PasswordEncrypter