From 0fa41045544761a863e44ee88c962bd78fd99eab Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 13 Sep 2024 15:47:49 +0200 Subject: doc for crypt helpers --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 -- cgit