Annotation of embedaddon/php/ext/standard/tests/strings/crypt.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: crypt() function
                      3: --SKIPIF--
                      4: <?php
                      5: if (!function_exists('crypt')) {
                      6:        die("SKIP crypt() is not available");
                      7: }
                      8: ?> 
                      9: --FILE--
                     10: <?php
                     11: 
                     12: $str = 'rasmuslerdorf';
                     13: $salt1 = 'rl';
                     14: $res_1 = 'rl.3StKT.4T8M';
                     15: $salt2 = '_J9..rasm';
                     16: $res_2 = '_J9..rasmBYk8r9AiWNc';
                     17: $salt3 = '$1$rasmusle$';
                     18: $res_3 = '$1$rasmusle$rISCgZzpwk3UhDidwXvin0';
                     19: $salt4 = '$2a$07$rasmuslerd............';
                     20: $res_4 = '$2a$07$rasmuslerd............nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra';
                     21: 
                     22: echo (CRYPT_STD_DES)  ? ((crypt($str, $salt1) === $res_1) ? 'STD' : 'STD - ERROR') : 'STD', "\n";
                     23: echo (CRYPT_EXT_DES)  ? ((crypt($str, $salt2) === $res_2) ? 'EXT' : 'EXT - ERROR') : 'EXT', "\n";
                     24: echo (CRYPT_MD5)      ? ((crypt($str, $salt3) === $res_3) ? 'MD5' : 'MD5 - ERROR') : 'MD5', "\n";
                     25: echo (CRYPT_BLOWFISH) ? ((crypt($str, $salt4) === $res_4) ? 'BLO' : 'BLO - ERROR') : 'BLO', "\n";
                     26: 
                     27: var_dump(crypt($str));
                     28: var_dump(crypt());
                     29: var_dump(crypt("", "", ""));
                     30: 
                     31: ?>
                     32: --EXPECTF--
                     33: STD
                     34: EXT
                     35: MD5
                     36: BLO
                     37: string(%d) "%s"
                     38: 
                     39: Warning: crypt() expects at least 1 parameter, 0 given in %s on line %d
                     40: NULL
                     41: 
                     42: Warning: crypt() expects at most 2 parameters, 3 given in %s on line %d
                     43: NULL

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>