|
Wt
3.3.0
|
An cryptographic hash function that implements bcrypt. More...
#include <Wt/Auth/HashFunction>

Public Member Functions | |
| BCryptHashFunction (int count=0) | |
| Constructor. | |
| virtual std::string | name () const |
| Returns the name for this hash function. | |
| virtual std::string | compute (const std::string &msg, const std::string &salt) const |
| Computes the hash of a message + salt. | |
| virtual bool | verify (const std::string &msg, const std::string &hash, const std::string &salt) const |
| Verifies a message with the salted hash. | |
An cryptographic hash function that implements bcrypt.
This hashing function is intended for password hashes. In addition to be collision-resistant, the bcrypt algorithm has a parameter which makes the computation more computationally intensive. In this way, a dictionary-based attack on a compromised hash is also less feasible.
| Wt::Auth::BCryptHashFunction::BCryptHashFunction | ( | int | count = 0 | ) |
Constructor.
The count parameter controls the number of iterations, and thus the computational complexity. With a value of 0, a small default is chosen. The computational complexity increases exponentionally with increasing values f count. The parameter only affects new hashes computed with compute(), and its value is stored in the computed hash.
The value of count needs to be 0, or in the range 4-31.
| std::string Wt::Auth::BCryptHashFunction::compute | ( | const std::string & | msg, |
| const std::string & | salt | ||
| ) | const [virtual] |
Computes the hash of a message + salt.
The message is usually an ASCII or UTF-8 string.
The salt and the computed hash are encoded in printable characters. This is usually ASCII-encoded(as for the UNIX crypt() functions)or could be Base64-encoded.
Implements Wt::Auth::HashFunction.
| std::string Wt::Auth::BCryptHashFunction::name | ( | ) | const [virtual] |
| bool Wt::Auth::BCryptHashFunction::verify | ( | const std::string & | msg, |
| const std::string & | salt, | ||
| const std::string & | hash | ||
| ) | const [virtual] |
Verifies a message with the salted hash.
The base implementation will recompute the hash of the message with the given salt, and compare it to the hash.
Some methods however store the salt and additional settings in the hash, and this information is thus needed to verify the message hash.
Reimplemented from Wt::Auth::HashFunction.
1.7.5.1