shiro 加密 java sha-256

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();

猜你喜欢

转载自blog.csdn.net/lv842586821/article/details/77989949
今日推荐