1--TEST--
2crypt() SHA-512
3--FILE--
4<?php
5
6$tests = array(
7	1 => array(
8		'$6$saltstring',
9		'Hello world!',
10		'$6$saltstring$svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3uBnIFNjnQJuesI68u4OTLiBFdcbYEdFCoEOfaS35inz1'
11	),
12	2 => array(
13		'$6$rounds=10000$saltstringsaltstring',
14		'Hello world!',
15		'$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sbHbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v.'
16	),
17	3 => array(
18		'$6$rounds=5000$toolongsaltstring',
19		'This is just a test',
20		'$6$rounds=5000$toolongsaltstrin$lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQzQ3glMhwllF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0'
21	),
22	4 => array(
23		'$6$rounds=1400$anotherlongsaltstring',
24		'a very much longer text to encrypt.  This one even stretches over morethan one line.',
25		'$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wPvMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1'
26	),
27	5 => array(
28		'$6$rounds=77777$short',
29		'we have a short salt string but not a short password',
30		'$6$rounds=77777$short$WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr0gge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0'
31	),
32	6 => array(
33		'$6$rounds=123456$asaltof16chars..',
34		'a short string',
35		'$6$rounds=123456$asaltof16chars..$BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwcelCjmw2kSYu.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1'
36	),
37	7 => array(
38		'$6$rounds=10$roundstoolow',
39		'the minimum number is still observed',
40		'$6$rounds=1000$roundstoolow$kUMsbe306n21p9R.FRkW3IGn.S9NPN0x50YhH1xhLsPuWGsUSklZt58jaTfF4ZEQpyUNGc0dqbpBYYBaHHrsX.'
41	),
42	8 => array(
43		'$6$$bar$',
44		'foo',
45		'$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu.'
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?>
57--EXPECT--
58Passes.
59