Wt: Wt::Auth::SHA1HashFunction Class Reference

Wt 4.10.4

Loading...
Searching...
No Matches
Public Member Functions | List of all members
Wt::Auth::SHA1HashFunction Class Referencefinal

A cryptographic hash function implemented using SHA1. More...

`#include <Wt/Auth/HashFunction.h>`

Inheritance diagram for Wt::Auth::SHA1HashFunction:
[legend]

## Public Member Functions
virtual std::string | name () const override
| Returns the name for this hash function.
virtual std::string | compute (const std::string &msg, const std::string &salt) const override
| Computes the hash of a message + salt.
Public Member Functions inherited from Wt::Auth::HashFunction
virtual | ~HashFunction ()
| Destructor.
virtual bool | verify (const std::string &msg, const std::string &salt, const std::string &hash) const
| Verifies a message with the salted hash.

## Detailed Description

A cryptographic hash function implemented using SHA1.

This hash function is only available if Wt was compiled with OpenSSL support.

This hash function is useful for creating token hashes, but should not be used for password hashes.

## Member Function Documentation

## ◆ compute()

virtual std::string Wt::Auth::SHA1HashFunction::compute | ( | const std::string & | msg,
|  | const std::string & | salt ) const
| overridevirtual

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.

## ◆ name()

virtual std::string Wt::Auth::SHA1HashFunction::name | ( |  | ) | const
| overridevirtual

Returns the name for this hash function.

Returns `"SHA1"`.

Implements Wt::Auth::HashFunction.