-
Notifications
You must be signed in to change notification settings - Fork 0
setAlgorithm
Corey Avis edited this page Sep 23, 2026
·
2 revisions
Sets the active hashing algorithm for the class. This method features automatic case-normalization and a multi-tiered fallback system to guarantee the class never enters an invalid state.
setAlgorithm(string $algo): static
algo (string)
: The name of the hashing algorithm to set (e.g., 'sha256', 'sha512', 'whirlpool'). Case-insensitive.
📌 If the requested algorithm does not exist on the host system then it attempts to fall back to the default algorithm defined in your configuration.
If the configuration is missing or contains an invalid algorithm, it safely defaults to
sha256as an absolute system fallback.
(static) : Returns the current instance to allow for method chaining.
$sec->setAlgorithm('md5');
| Config Key | Default Value | Allowed Values | Description |
|---|---|---|---|
| algorithm | sha256 | string (See: ) | Default hashing algorithm. |
- No debug errors.
algorithmExists | getAlgorithm | listAlgorithms