Botan
1.11.15
|
00001 /* 00002 * Passhash9 Password Hashing 00003 * (C) 2010 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_PASSHASH9_H__ 00009 #define BOTAN_PASSHASH9_H__ 00010 00011 #include <botan/rng.h> 00012 00013 namespace Botan { 00014 00015 /** 00016 * Create a password hash using PBKDF2 00017 * @param password the password 00018 * @param rng a random number generator 00019 * @param work_factor how much work to do to slow down guessing attacks 00020 * @param alg_id specifies which PRF to use with PBKDF2 00021 * 0 is HMAC(SHA-1) 00022 * 1 is HMAC(SHA-256) 00023 * 2 is CMAC(Blowfish) 00024 * 3 is HMAC(SHA-384) 00025 * 4 is HMAC(SHA-512) 00026 * all other values are currently undefined 00027 */ 00028 std::string BOTAN_DLL generate_passhash9(const std::string& password, 00029 RandomNumberGenerator& rng, 00030 u16bit work_factor = 10, 00031 byte alg_id = 1); 00032 00033 /** 00034 * Check a previously created password hash 00035 * @param password the password to check against 00036 * @param hash the stored hash to check against 00037 */ 00038 bool BOTAN_DLL check_passhash9(const std::string& password, 00039 const std::string& hash); 00040 00041 } 00042 00043 #endif