shiro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdem...@apache.org
Subject [5/5] shiro git commit: Fix the calculation for the hash iterations
Date Wed, 29 Jun 2016 22:06:19 GMT
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 <andreas.kohn@gmail.com>
Authored: Thu Apr 21 10:26:44 2016 +0200
Committer: Brian Demers <bdemers@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();


Mime
View raw message