diff options
author | Remi Collet <remi@remirepo.net> | 2024-09-13 10:13:12 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2024-09-13 10:13:12 +0200 |
commit | ef4627a6a618b460cbbea109e3e0522c891be72c (patch) | |
tree | 466a4678a4c18d4a636f3375f4b72e3045cde437 /tests/password_compat.phpt | |
parent | 5bca3985ce597abd2db703e0944160a8f73dd84a (diff) |
More bindings (function missing in php)
- add crypt_gensalt(?string $salt = null, int $count = 0): ?string {}
- add crypt_preferred_method(): ?string {}
- add crypt_checksalt(string $salt): int {}
and bump version to 1.1.0-dev (new functions)
Diffstat (limited to 'tests/password_compat.phpt')
-rw-r--r-- | tests/password_compat.phpt | 22 |
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) + |