diff options
-rw-r--r-- | checks/validate.cpp | 2 | ||||
-rw-r--r-- | src/passhash/passhash9/passhash9.cpp | 13 | ||||
-rw-r--r-- | src/passhash/passhash9/passhash9.h | 14 |
3 files changed, 5 insertions, 24 deletions
diff --git a/checks/validate.cpp b/checks/validate.cpp index 9acf73419..d79f9783a 100644 --- a/checks/validate.cpp +++ b/checks/validate.cpp @@ -239,7 +239,7 @@ bool test_passhash(RandomNumberGenerator& rng) for(byte alg_id = 0; alg_id <= 2; ++alg_id) { - std::string gen_hash = generate_passhash9(input, alg_id, rng, 1); + std::string gen_hash = generate_passhash9(input, rng, 2, alg_id); if(!check_passhash9(input, gen_hash)) return false; diff --git a/src/passhash/passhash9/passhash9.cpp b/src/passhash/passhash9/passhash9.cpp index e5f379052..e1e37da1e 100644 --- a/src/passhash/passhash9/passhash9.cpp +++ b/src/passhash/passhash9/passhash9.cpp @@ -23,8 +23,6 @@ const size_t ALGID_BYTES = 1; const size_t SALT_BYTES = 12; // 96 bits of salt const size_t PASSHASH9_PBKDF_OUTPUT_LEN = 24; // 192 bits output -const byte PASSHASH9_DEFAULT_ALGO = 0; // HMAC(SHA-1) - const size_t WORK_FACTOR_SCALE = 10000; MessageAuthenticationCode* get_pbkdf_prf(byte alg_id) @@ -49,15 +47,8 @@ MessageAuthenticationCode* get_pbkdf_prf(byte alg_id) std::string generate_passhash9(const std::string& pass, RandomNumberGenerator& rng, - u16bit work_factor) - { - return generate_passhash9(pass, PASSHASH9_DEFAULT_ALGO, rng, work_factor); - } - -std::string generate_passhash9(const std::string& pass, - byte alg_id, - RandomNumberGenerator& rng, - u16bit work_factor) + u16bit work_factor, + byte alg_id) { MessageAuthenticationCode* prf = get_pbkdf_prf(alg_id); diff --git a/src/passhash/passhash9/passhash9.h b/src/passhash/passhash9/passhash9.h index 92cc391dc..3c0a4be51 100644 --- a/src/passhash/passhash9/passhash9.h +++ b/src/passhash/passhash9/passhash9.h @@ -17,26 +17,16 @@ namespace Botan { * @param password the password * @param rng a random number generator * @param work_factor how much work to do to slow down guessing attacks -*/ -std::string BOTAN_DLL generate_passhash9(const std::string& password, - RandomNumberGenerator& rng, - u16bit work_factor = 10); - -/** -* Create a password hash using PBKDF2 -* @param password the password * @param alg_id specifies which PRF to use with PBKDF2 * 0 is HMAC(SHA-1) * 1 is HMAC(SHA-256) * 2 is CMAC(Blowfish) * all other values are currently undefined -* @param rng a random number generator -* @param work_factor how much work to do to slow down guessing attacks */ std::string BOTAN_DLL generate_passhash9(const std::string& password, - byte alg_id, RandomNumberGenerator& rng, - u16bit work_factor = 10); + u16bit work_factor = 10, + byte alg_id = 0); /** * Check a previously created password hash |