Skip to content

Commit 0fa4104

Browse files
committed
doc for crypt helpers
1 parent 6c7eb26 commit 0fa4104

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,25 @@ From the sources tree
6767

6868
* `cost` controls the CPU time cost of the hash. If `cost` is 0, a reasonable default cost will be selected.
6969

70+
## crypt helpers
71+
72+
$ php -a
73+
74+
php > var_dump(crypt_preferred_method());
75+
string(3) "$y$"
76+
77+
php > var_dump($salt = crypt_gensalt());
78+
string(29) "$y$j9T$EitfN8MxRjFzV5tNe97D70"
79+
80+
php > var_dump(crypt_checksalt($salt) == CRYPT_SALT_OK);
81+
bool(true)
82+
83+
php > var_dump($hash = crypt("secret", $salt));
84+
string(73) "$y$j9T$EitfN8MxRjFzV5tNe97D70$vGtxczdGMTLh0LfpwxAmyzgba7EODsmazEh03kpvbh3"
85+
86+
php > var_dump($hash === crypt("secret", $hash));
87+
bool(true)
88+
7089
# LICENSE
7190

7291
Author: Remi Collet

0 commit comments

Comments
 (0)