title: Hash with MD5 in Java?
body: <p>I am creating one program that will take the user output of login and password and hash this variables(login and password).</p>
  
  <p>When I hash the output from login It works but when I try hash the output from the password doens't work.</p>
  
  <p><strong>Code :</strong> </p>
  
  <pre><code>String login;
  String password;
  
  
  login = JOptionPane.showInputDialog("Login : ");
  password = JOptionPane.showInputDialog("Password : ");
  
  MessageDigest m; 
  
  
  try 
  { 
  m = MessageDigest.getInstance("MD5");
  m.update(login.getBytes(),0,login.length()); 
  m.update(password.getBytes(),0,password.length());
  BigInteger login1 = new BigInteger(1, m.digest()); 
  BigInteger password1 = new BigInteger(1, m.digest());
  
  login = String.format("%1$032X", login1); 
  password = String.format("%1$032X", password1); 
  
  JOptionPane.showMessageDialog(null,"Login : " + login + 
                  "\nPassword : " + password);
  
  //System.out.println("login : "+ login); 
  //System.out.println("password : " + password);
  } 
  </code></pre>
  
  <p><strong>Output :</strong></p>
  
  <pre><code>login : E9CA9D798BA364DFF16C738D03AF6668
  password : D41D8CD98F00B204E9800998ECF8427E
  </code></pre>
  
  <p>The variable login goes normal,but the password always do the same result when hashing,I want to make the variable password always get some different result when hashing.</p>
  
  <p><strong>PS : Sorry for the bad English,not my native language.</strong></p>