summaryrefslogtreecommitdiffstats
path: root/tests/password_compat.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/password_compat.phpt')
-rw-r--r--tests/password_compat.phpt22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/password_compat.phpt b/tests/password_compat.phpt
new file mode 100644
index 0000000..3dd6ad2
--- /dev/null
+++ b/tests/password_compat.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test crypt compatibility with password_hash
+--FILE--
+<?php
+$secret = 'mysecret';
+
+/* generate with password_hash, check with both */
+$h = password_hash($secret, PASSWORD_BCRYPT);
+var_dump($h, password_verify($secret, $h), $h===crypt($secret, $h));
+
+/* generate with crypt, check with both */
+$h = crypt($secret, crypt_gensalt(XPASS_CRYPT_BLOWFISH));
+var_dump($h, password_verify($secret, $h), $h===crypt($secret, $h));
+?>
+--EXPECTF--
+string(60) "$2y$%s$%s"
+bool(true)
+bool(true)
+string(60) "$2y$%s$%s"
+bool(true)
+bool(true)
+