~ubuntu-branches/debian/sid/botan/sid

« back to all changes in this revision

Viewing changes to src/lib/passhash/passhash9/passhash9.h

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2018-03-01 22:23:25 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20180301222325-7p7vc45gu3hta34d
Tags: 2.4.0-2
* Don't remove .doctrees from the manual if it doesn't exist.
* Don't specify parallel to debhelper.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* Passhash9 Password Hashing
 
3
* (C) 2010 Jack Lloyd
 
4
*
 
5
* Botan is released under the Simplified BSD License (see license.txt)
 
6
*/
 
7
 
 
8
#ifndef BOTAN_PASSHASH9_H_
 
9
#define BOTAN_PASSHASH9_H_
 
10
 
 
11
#include <botan/types.h>
 
12
#include <string>
 
13
 
 
14
namespace Botan {
 
15
 
 
16
class RandomNumberGenerator;
 
17
 
 
18
/**
 
19
* Create a password hash using PBKDF2
 
20
* @param password the password
 
21
* @param rng a random number generator
 
22
* @param work_factor how much work to do to slow down guessing attacks
 
23
* @param alg_id specifies which PRF to use with PBKDF2
 
24
*        0 is HMAC(SHA-1)
 
25
*        1 is HMAC(SHA-256)
 
26
*        2 is CMAC(Blowfish)
 
27
*        3 is HMAC(SHA-384)
 
28
*        4 is HMAC(SHA-512)
 
29
*        all other values are currently undefined
 
30
*/
 
31
std::string BOTAN_PUBLIC_API(2,0) generate_passhash9(const std::string& password,
 
32
                                         RandomNumberGenerator& rng,
 
33
                                         uint16_t work_factor = 10,
 
34
                                         uint8_t alg_id = 1);
 
35
 
 
36
/**
 
37
* Check a previously created password hash
 
38
* @param password the password to check against
 
39
* @param hash the stored hash to check against
 
40
*/
 
41
bool BOTAN_PUBLIC_API(2,0) check_passhash9(const std::string& password,
 
42
                               const std::string& hash);
 
43
 
 
44
/**
 
45
* Check if the PRF used with PBKDF2 is supported
 
46
* @param alg_id alg_id used in generate_passhash9()
 
47
*/
 
48
bool BOTAN_PUBLIC_API(2,3) is_passhash9_alg_supported(uint8_t alg_id);
 
49
 
 
50
}
 
51
 
 
52
#endif