summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2024-09-13 15:47:49 +0200
committerRemi Collet <remi@php.net>2024-09-13 15:47:49 +0200
commit0fa41045544761a863e44ee88c962bd78fd99eab (patch)
tree0870cae8a42c6f0ac5860d6080fb7ceabaaa945c /README.md
parent6c7eb261b7537e429719dd59b392c0421eaa5ce2 (diff)
doc for crypt helpers
Diffstat (limited to 'README.md')
-rw-r--r--README.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/README.md b/README.md
index 2cd1e7d..6b2ecb5 100644
--- a/README.md
+++ b/README.md
@@ -67,6 +67,25 @@ From the sources tree
* `cost` controls the CPU time cost of the hash. If `cost` is 0, a reasonable default cost will be selected.
+## crypt helpers
+
+ $ php -a
+
+ php > var_dump(crypt_preferred_method());
+ string(3) "$y$"
+
+ php > var_dump($salt = crypt_gensalt());
+ string(29) "$y$j9T$EitfN8MxRjFzV5tNe97D70"
+
+ php > var_dump(crypt_checksalt($salt) == CRYPT_SALT_OK);
+ bool(true)
+
+ php > var_dump($hash = crypt("secret", $salt));
+ string(73) "$y$j9T$EitfN8MxRjFzV5tNe97D70$vGtxczdGMTLh0LfpwxAmyzgba7EODsmazEh03kpvbh3"
+
+ php > var_dump($hash === crypt("secret", $hash));
+ bool(true)
+
# LICENSE
Author: Remi Collet