Variables:
String login;
String password;
MessageDigest m;
MessageDigest m1;
Encryption process for MD5:
try
{
m = MessageDigest.getInstance("MD5");
m1 = MessageDigest.getInstance("MD5");
m.update(login.getBytes(),0,login.length());
m1.update(password.getBytes(),0,password.length());
BigInteger login1 = new BigInteger(1, m.digest());
BigInteger password1 = new BigInteger(1, m.digest());
//Formatando o resultado em uma cadeia de 32 caracteres, completando com 0 caso falte
login = String.format("%1$032X", login1);
password = String.format("%1$032X", password1);
System.out.println("MD5: "+ login);
System.out.println("MD5: " + password);
}
No output:
login : 011DD1032ECECFB4497613E48049972C
password : D41D8CD98F00B204E9800998ECF8427E
In the output of the password always ends up being the same hash, and in the login always comes out a different result (a different hash), I would like to know how I can arrange this to always get a different result like the login variable.