You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by bd...@apache.org on 2016/06/29 22:06:19 UTC
[5/5] shiro git commit: Fix the calculation for the hash iterations
Fix the calculation for the hash iterations
We really need to subtract 1 here, not DEFAULT_ITERATIONS (which could
change, breaking the calculation then)
Fixes #14, SHIRO-568
Project: http://git-wip-us.apache.org/repos/asf/shiro/repo
Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/01b35626
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/01b35626
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/01b35626
Branch: refs/heads/master
Commit: 01b35626ac7cf9bb3c4f584c2c649ef5c190ac4b
Parents: 50393a2
Author: Andreas Kohn <an...@gmail.com>
Authored: Thu Apr 21 10:26:44 2016 +0200
Committer: Brian Demers <bd...@stormpath.com>
Committed: Wed Jun 29 14:22:32 2016 -0700
----------------------------------------------------------------------
.../src/main/java/org/apache/shiro/crypto/hash/SimpleHash.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/shiro/blob/01b35626/crypto/hash/src/main/java/org/apache/shiro/crypto/hash/SimpleHash.java
----------------------------------------------------------------------
diff --git a/crypto/hash/src/main/java/org/apache/shiro/crypto/hash/SimpleHash.java b/crypto/hash/src/main/java/org/apache/shiro/crypto/hash/SimpleHash.java
index 7ee3c40..b3c8a33 100644
--- a/crypto/hash/src/main/java/org/apache/shiro/crypto/hash/SimpleHash.java
+++ b/crypto/hash/src/main/java/org/apache/shiro/crypto/hash/SimpleHash.java
@@ -346,7 +346,7 @@ public class SimpleHash extends AbstractHash {
digest.update(salt);
}
byte[] hashed = digest.digest(bytes);
- int iterations = hashIterations - DEFAULT_ITERATIONS; //already hashed once above
+ int iterations = hashIterations - 1; //already hashed once above
//iterate remaining number:
for (int i = 0; i < iterations; i++) {
digest.reset();