Botan  1.11.15
src/lib/passhash/bcrypt/bcrypt.h
Go to the documentation of this file.
00001 /*
00002 * Bcrypt Password Hashing
00003 * (C) 2011 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_BCRYPT_H__
00009 #define BOTAN_BCRYPT_H__
00010 
00011 #include <botan/rng.h>
00012 
00013 namespace Botan {
00014 
00015 /**
00016 * Create a password hash using Bcrypt
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 *
00021 * @see http://www.usenix.org/events/usenix99/provos/provos_html/
00022 */
00023 std::string BOTAN_DLL generate_bcrypt(const std::string& password,
00024                                       RandomNumberGenerator& rng,
00025                                       u16bit work_factor = 10);
00026 
00027 /**
00028 * Check a previously created password hash
00029 * @param password the password to check against
00030 * @param hash the stored hash to check against
00031 */
00032 bool BOTAN_DLL check_bcrypt(const std::string& password,
00033                             const std::string& hash);
00034 
00035 }
00036 
00037 #endif