title: Spring Security Encrypt MD5
body: <p>I have a java web application using spring framework and spring security for its login. In my database I have my passwords encrypted to MD5 before being saved. I added in my application-config.xml this codes</p>
  
  <pre><code> &lt;security:authentication-provider&gt;
  &lt;security:password-encoder hash="md5"/&gt;
  &lt;security:jdbc-user-service
          data-source-ref="dataSource"
          users-by-username-query="select user_name username, user_password password, 1 enabled from users where user_name=?"
          authorities-by-username-query="select username, authority from authorities where username=?" /&gt;
  &lt;/security:authentication-provider&gt;
  </code></pre>
  
  <p>At first It worked when the password in the db were not encrypted. But when I encrypted it and added this snippet in my application config</p>
  
  <pre><code>      &lt;security:password-encoder hash="md5"/&gt;
  </code></pre>
  
  <p>I am not able to login.</p>