diff options
-rw-r--r-- | src/block/blowfish/blowfish.cpp | 7 | ||||
-rw-r--r-- | src/passhash/bcrypt/bcrypt.cpp (renamed from src/constructs/bcrypt/bcrypt.cpp) | 2 | ||||
-rw-r--r-- | src/passhash/bcrypt/bcrypt.h (renamed from src/constructs/bcrypt/bcrypt.h) | 0 | ||||
-rw-r--r-- | src/passhash/bcrypt/info.txt (renamed from src/constructs/bcrypt/info.txt) | 0 | ||||
-rw-r--r-- | src/passhash/passhash9/info.txt (renamed from src/constructs/passhash/info.txt) | 0 | ||||
-rw-r--r-- | src/passhash/passhash9/passhash9.cpp (renamed from src/constructs/passhash/passhash9.cpp) | 0 | ||||
-rw-r--r-- | src/passhash/passhash9/passhash9.h (renamed from src/constructs/passhash/passhash9.h) | 0 |
7 files changed, 7 insertions, 2 deletions
diff --git a/src/block/blowfish/blowfish.cpp b/src/block/blowfish/blowfish.cpp index 6610decd8..b6319eec0 100644 --- a/src/block/blowfish/blowfish.cpp +++ b/src/block/blowfish/blowfish.cpp @@ -117,7 +117,12 @@ void Blowfish::eks_key_schedule(const byte key[], size_t length, if(workfactor == 0) throw std::invalid_argument("Bcrypt work factor must be at least 1"); - if(workfactor > 24) // ok? + /* + * On a 2.8 GHz Core-i7, workfactor == 18 takes about 25 seconds to + * hash a password. This seems like a reasonable upper bound for the + * time being. + */ + if(workfactor > 18) throw std::invalid_argument("Requested Bcrypt work factor too large"); clear(); diff --git a/src/constructs/bcrypt/bcrypt.cpp b/src/passhash/bcrypt/bcrypt.cpp index b2152a0a7..e533c6081 100644 --- a/src/constructs/bcrypt/bcrypt.cpp +++ b/src/passhash/bcrypt/bcrypt.cpp @@ -142,7 +142,7 @@ bool check_bcrypt(const std::string& pass, const std::string& hash) return false; } - const size_t workfactor = to_u32bit(hash.substr(4, 2)); + const u16bit workfactor = to_u32bit(hash.substr(4, 2)); MemoryVector<byte> salt = bcrypt_base64_decode(hash.substr(7, 22)); diff --git a/src/constructs/bcrypt/bcrypt.h b/src/passhash/bcrypt/bcrypt.h index 8a6ab58ea..8a6ab58ea 100644 --- a/src/constructs/bcrypt/bcrypt.h +++ b/src/passhash/bcrypt/bcrypt.h diff --git a/src/constructs/bcrypt/info.txt b/src/passhash/bcrypt/info.txt index 91ab92e88..91ab92e88 100644 --- a/src/constructs/bcrypt/info.txt +++ b/src/passhash/bcrypt/info.txt diff --git a/src/constructs/passhash/info.txt b/src/passhash/passhash9/info.txt index f96809f29..f96809f29 100644 --- a/src/constructs/passhash/info.txt +++ b/src/passhash/passhash9/info.txt diff --git a/src/constructs/passhash/passhash9.cpp b/src/passhash/passhash9/passhash9.cpp index e5f379052..e5f379052 100644 --- a/src/constructs/passhash/passhash9.cpp +++ b/src/passhash/passhash9/passhash9.cpp diff --git a/src/constructs/passhash/passhash9.h b/src/passhash/passhash9/passhash9.h index 92cc391dc..92cc391dc 100644 --- a/src/constructs/passhash/passhash9.h +++ b/src/passhash/passhash9/passhash9.h |