PHP - sha1
Trieda
Metóda - sha1
(PHP 4 >= 4.3.0, PHP 5, PHP 7)
The sha1() function is used for calculating the sha1 hash of a
string.
Warning: It's not recommended to use this function to hash
passwords since it's easy to crack. For this purpose use the
password_hash() function.
Procedurálne
- function sha1 (string $str, bool $raw_output = false) : string
Parametre
| Názov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $str | string | The string to compute the sha1 hash from. | |
| $raw_output | bool | false | If the |
Mávratovej hodnoty
Vracia: string
Returns the hashed string as a 40-character long hexadecimal number.
Príklady
<?php
echo sha1('test'); // hexadecimal format: a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
echo '<br>';
echo sha1('test', true); // raw binary format
Súvisiace manuály
- function crypt (string $str, string $salt) : string
- function hash (string $algo, string $data, bool $raw_output = false) : string
- function password_hash (string $password, integer $algo, array $options) : string
