title: Shiro matching credentialsMatcher and user password creation not matching
body: <p>I am using shiro as authentication for my java 1.8 application. My user creation will sha256 and salt.</p>
  
  <p>Shiro will only match passwords when they are exact in the database an entered. For example if the database password was in plaintext and was 'password' and i entered 'password' it would work.</p>
  
  <p>If i entered 'password' when the password is encrypted in the database it does not match and will fail.</p>
  
  <p>How do i get shiro to create a sha256 and salted password from what was entered so the passwords will match?</p>
  
  <p>My user creation code</p>
  
  <pre><code>EntityManagerFactory factory = 
                      Persistence.createEntityManagerFactory("e");
  
              EntityManager em = factory.createEntityManager();
              em.getTransaction().begin();
  
              com.e.dto.User user = new com.e.dto.User();
  
              DefaultPasswordService a = new DefaultPasswordService();
              password = a.encryptPassword(password);
  
              user.setUsername(username);
              user.setPassword(password);
  
              em.persist(user);
  
          em.getTransaction().commit();
  </code></pre>
  
  <p>shiro.ini</p>
  
  <pre><code>jdbcRealm=org.apache.shiro.realm.jdbc.JdbcRealm
  jdbcRealm.authenticationQuery = SELECT password from user where username = ?
  jdbcRealm.userRolesQuery = select role from userroles where userID = (select id FROM user WHERE username = ?)
  
  ds = com.mysql.jdbc.jdbc2.optional.MysqlDataSource
  ds.serverName = localhost
  ds.user = root
  ds.password = password
  ds.databaseName = myDatabase
  jdbcRealm.dataSource= $ds
  
  credentialsMatcher = org.apache.shiro.authc.credential.HashedCredentialsMatcher
  credentialsMatcher.hashAlgorithmName = SHA-256
  credentialsMatcher.storedCredentialsHexEncoded = true
  credentialsMatcher.hashIterations = 10000
  credentialsMatcher.hashSalted = true
  </code></pre>
  
  <p>New Users password</p>
  
  <pre><code>$shiro1$SHA-256$500000$xRvz5dByhvAtFG7VHlCjHA==$xxakvEZdBF6cI+UmyR1OY098tAlscOKhpwQuT7THijw=
  </code></pre>