title: How to Authenticate MD5
body: <p>I creating MD5 this way:</p>
  
  <pre><code>public void encrypeUsername(String sessionid)
      {
          byte[] defaultBytes = sessionid.getBytes();
          try
          {
              MessageDigest algorithm = MessageDigest.getInstance("MD5");
              algorithm.reset();
              algorithm.update(defaultBytes);
              byte messageDigest[] = algorithm.digest();
  
              StringBuffer hexString = new StringBuffer();
              for (int i = 0; i &lt; messageDigest.length; i++)
              {
                  hexString.append(Integer.toHexString(0xFF &amp; messageDigest[i]));
              }
              System.out.println("sessionid " + sessionid + " md5 version is " + hexString.toString());
          }
          catch (Exception e)
          {
              e.printStackTrace();
          }
  
  
  
      }
  </code></pre>
  
  <p>for input 123456 we get MD5: e1adc3949ba59abbe56e057f2f883e </p>
  
  <p>I want to create another method to authenticate the result.</p>
  
  <p>For example if i give an input of e1adc3949ba59abbe56e057f2f883e and "123456" then I get as result: true/false.</p>
  
  <p>Any idea how to achieve this?</p>
  
  <p>thanks,
  ray.</p>