summaryrefslogtreecommitdiffstats
path: root/tests/crypt_checksalt.phpt
blob: 0a0f6eeec4fe09ff6e1acca07cd103552e4a6cc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--TEST--
Test crypt_checksalt
--FILE--
<?php
// salt with old algo is OK or LEGACY
$r = crypt_checksalt(crypt_gensalt(CRYPT_PREFIX_STD_DES));
var_dump($r === CRYPT_SALT_METHOD_LEGACY || $r === CRYPT_SALT_OK);

// salt with default algo is OK
$r = crypt_checksalt(crypt_gensalt());
var_dump($r === CRYPT_SALT_OK);

// bad salt is INVALID
$r = crypt_checksalt("!not_a_valid_hash");
var_dump($r === CRYPT_SALT_INVALID);
?>
--EXPECT--
bool(true)
bool(true)
bool(true)