diff options
author | Leigh <leight@gmail.com> | 2014-10-07 11:50:36 +0100 |
---|---|---|
committer | Leigh <leight@gmail.com> | 2014-10-07 11:50:36 +0100 |
commit | a0420a72afe064d3cb04735c0966eba053a868a7 (patch) | |
tree | 3fbbacca060a4d82144974b064b00a19383c3930 /ext/standard | |
parent | e331f9af73ba6e34fd757f368fdf0d9a585f763c (diff) | |
download | php-git-a0420a72afe064d3cb04735c0966eba053a868a7.tar.gz |
Add tests from 1.3. Add missing tests.
3 of the missing tests fail. // TODO
Diffstat (limited to 'ext/standard')
-rw-r--r-- | ext/standard/tests/strings/crypt_blowfish.phpt | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/ext/standard/tests/strings/crypt_blowfish.phpt b/ext/standard/tests/strings/crypt_blowfish.phpt index 20a6a2750a..2bb2b5ff34 100644 --- a/ext/standard/tests/strings/crypt_blowfish.phpt +++ b/ext/standard/tests/strings/crypt_blowfish.phpt @@ -18,8 +18,10 @@ $tests =array( array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"), array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"), array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.nqd1wy.pTMdcvrRWxyiGL2eMz.2a85.', "\xff\xff\xa3"), + array('$2b$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"), array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"), array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"), + array('$2b$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"), array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "1\xa3345"), array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa3345"), array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345"), @@ -36,14 +38,35 @@ $tests =array( array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.R9xrDjiycxMbQE2bp.vgqlYpW5wx2yy', "\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55"), array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.9tQZzcJfm3uj2NvJ/n5xkhpqLrMpWCe', "\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff"), array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.7uG0VCzI2bS7j6ymqJi9CdcdxiRTWNy', ''), +); +$tests2 = array( + array('$2a$03$CCCCCCCCCCCCCCCCCCCCC.', '*0'), + array('$2a$32$CCCCCCCCCCCCCCCCCCCCC.', '*0'), + array('$2c$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'), + array('$2z$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'), + array('$2`$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'), + array('$2{$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'), + array('*0', '*1'), ); + $i=0; foreach($tests as $test) { - if(crypt($test[1], $test[0]) == $test[0]) { + $result = crypt($test[1], $test[0]); + if($result === $test[0]) { + echo "$i. OK\n"; + } else { + echo "$i. Not OK: $test[0] $result\n"; + } + $i++; +} + +foreach($tests2 as $test) { + $result = crypt('', $test[0]); + if($result === $test[1]) { echo "$i. OK\n"; } else { - echo "$i. Not OK: $test[0] ".crypt($test[1], $test[0])."\n"; + echo "$i. Not OK: $test[0] $result\n"; } $i++; } @@ -76,3 +99,9 @@ foreach($tests as $test) { 23. OK 24. OK 25. OK +26. OK +27. OK +28. OK +29. OK +30. OK +31. OK |