TDefaultPasswordHasher Class
Default IPasswordHasher implementation, used by Sphinx when no custom password hasher is configured.
Remarks
A random per-password salt is prepended to the password and hashed with a single-pass SHA-2 digest (SHA-256 by default). The stored value has the format salt.hash, where salt is Base64Url-encoded. To use a stronger algorithm (such as PBKDF2, bcrypt or argon2), implement IPasswordHasher and assign it to TSphinxConfig.PasswordHasher.
Syntax
Unit: Sphinx.DefaultPasswordHasher
TDefaultPasswordHasher = class(TInterfacedObject, IPasswordHasher);
Constructors
| Name | Description |
|---|---|
| Create | Overloaded Create Create(TSHA2Version) |
Methods
| Name | Description |
|---|---|
| HashPassword | Hashes a password using a random salt and the configured SHA-2 variant. |
| VerifyHashedPassword | Verifies a provided password against the user's stored hash. |
Properties
| Name | Description |
|---|---|
| SaltLength | Gets or sets the length, in bytes, of the random salt generated for each password. |