shiro.xml配置:默认有base64,配置时没有 salt
<bean id="credentialsMatcher" class="org.apache.shiro.authc.credential.HashedCredentialsMatcher">
<property name="hashAlgorithmName" value="SHA-256"/>//加密名称
<property name="hashIterations" value="1024"/>//散列次数
<!-- Base64 encoding (less text): -->//默认base64
<property name="storedCredentialsHexEncoded" value="false"/>
</bean>
java:
加密方式:sha-256
加密字符:123456
salt:无/null
散列次数:1024次
第一种:
String password= new Sha256Hash("123456",null,1024).toBase64();
第二种:
String password = new SimpleHash("SHA-256","123456",null,2).toBase64();