其他分享
首页 > 其他分享> > shiro加密底层

shiro加密底层

作者:互联网

protected byte[] hash(byte[] bytes, byte[] salt, int hashIterations) throws UnknownAlgorithmException {
MessageDigest digest = this.getDigest(this.getAlgorithmName());
if (salt != null) {
digest.reset();
digest.update(salt);
}

byte[] hashed = digest.digest(bytes);
int iterations = hashIterations - 1;

for(int i = 0; i < iterations; ++i) {
digest.reset();
hashed = digest.digest(hashed);
}

return hashed;
}

标签:加密,int,hashed,shiro,iterations,byte,salt,digest,底层
来源: https://www.cnblogs.com/aypls/p/16184114.html