1--TEST--
2crypt() SHA-256
3--FILE--
4<?php
5
6$tests = array(
7	1 => array(
8		'$5$saltstring',
9		'Hello world!',
10		'$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5'
11	),
12	2 => array(
13		'$5$rounds=10000$saltstringsaltstring',
14		'Hello world!',
15		'$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA'
16	),
17	3 => array(
18		'$5$rounds=10000$saltstringsaltstring',
19		'Hello world!',
20		'$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA'
21	),
22	4 => array(
23		'$5$rounds=5000$toolongsaltstring',
24		'This is just a test',
25		'$5$rounds=5000$toolongsaltstrin$Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8mGRcvxa5'
26	),
27	5 => array(
28		'$5$rounds=1400$anotherlongsaltstring',
29		'a very much longer text to encrypt.  This one even stretches over morethan one line.',
30		'$5$rounds=1400$anotherlongsalts$Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12oP84Bnq1'
31	),
32	6 => array(
33		'$5$rounds=77777$short',
34		'we have a short salt string but not a short password',
35		'$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/'
36	),
37	7 => array(
38		'$5$rounds=123456$asaltof16chars..',
39		'a short string',
40		'$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/cZKmF/wJvD'
41	),
42	8 => array(
43		'$5$rounds=10$roundstoolow',
44		'the minimum number is still observed',
45		'$5$rounds=1000$roundstoolow$yfvwcWrQ8l/K0DAWyuPMDNHpIVlTQebY9l/gL972bIC'
46	)
47);
48
49foreach ($tests as $iter => $t) {
50	$res = crypt($t[1], $t[0]);
51	if ($res != $t[2]) echo "Iteration $iter failed.
52Expected: <$t[2]>
53Got       <$res>\n";
54}
55echo "Passes.";?>
56--EXPECT--
57Passes.
58