title: How can MD5 hashes be compared when logging in?
body: <p>Linux distros such as CentOS (v6.3 i.e.) are using a specific boot manager such as "GRUB", which contains a .conf file where you can edit your user information such as your password etc.</p>
  
  <p>the password must be encrypted using MD5 (i.e. : Password --md5 kw485/fgf$&amp;e), and that is a little bit confusing.</p>
  
  <p>Assuming that the MD5 is a one way encrypting method and that encrypting the same string will always give a newly generated string.</p>
  
  <p>How can the system compare the two passwords since they'll never match ? </p>
  
  <p>here is an example : </p>
  
  <pre><code>grub&gt; md5crypt
  md5crypt
  Password: hello
  hello
  Encrypted: $1$95Uz30$X/u7PX4F5GtEOsMguDDq10
  grub&gt; md5crypt
  md5crypt
  Password: hello
  hello
  Encrypted: $1$H8Uz30$LwAkSMZBYC07zJbx3lIVa1
  </code></pre>
  
  <p>as you can see we have inserted the same string and got two different results, assuming that's how a login scenario should happen such as : </p>
  
  <pre><code>$ login user
  password : hello
  </code></pre>
  
  <ul>
  <li>hello will be translated to <code>$1$H8Uz30$LwAkSMZBYC07zJbx3lIVa1</code> hashed
  password in grub.conf is  <code>$1$95Uz30$X/u7PX4F5GtEOsMguDDq10</code> that's a
  failed login attempt.</li>
  </ul>