1--TEST-- 2bcrypt correctly rejects salts containing $ 3--FILE-- 4<?php 5for ($i = 0; $i < 23; $i++) { 6 $salt = '$2y$04$' . str_repeat('0', $i) . '$'; 7 $result = crypt("foo", $salt); 8 var_dump($salt); 9 var_dump($result); 10 var_dump($result === $salt); 11} 12?> 13--EXPECT-- 14string(8) "$2y$04$$" 15string(2) "*0" 16bool(false) 17string(9) "$2y$04$0$" 18string(2) "*0" 19bool(false) 20string(10) "$2y$04$00$" 21string(2) "*0" 22bool(false) 23string(11) "$2y$04$000$" 24string(2) "*0" 25bool(false) 26string(12) "$2y$04$0000$" 27string(2) "*0" 28bool(false) 29string(13) "$2y$04$00000$" 30string(2) "*0" 31bool(false) 32string(14) "$2y$04$000000$" 33string(2) "*0" 34bool(false) 35string(15) "$2y$04$0000000$" 36string(2) "*0" 37bool(false) 38string(16) "$2y$04$00000000$" 39string(2) "*0" 40bool(false) 41string(17) "$2y$04$000000000$" 42string(2) "*0" 43bool(false) 44string(18) "$2y$04$0000000000$" 45string(2) "*0" 46bool(false) 47string(19) "$2y$04$00000000000$" 48string(2) "*0" 49bool(false) 50string(20) "$2y$04$000000000000$" 51string(2) "*0" 52bool(false) 53string(21) "$2y$04$0000000000000$" 54string(2) "*0" 55bool(false) 56string(22) "$2y$04$00000000000000$" 57string(2) "*0" 58bool(false) 59string(23) "$2y$04$000000000000000$" 60string(2) "*0" 61bool(false) 62string(24) "$2y$04$0000000000000000$" 63string(2) "*0" 64bool(false) 65string(25) "$2y$04$00000000000000000$" 66string(2) "*0" 67bool(false) 68string(26) "$2y$04$000000000000000000$" 69string(2) "*0" 70bool(false) 71string(27) "$2y$04$0000000000000000000$" 72string(2) "*0" 73bool(false) 74string(28) "$2y$04$00000000000000000000$" 75string(2) "*0" 76bool(false) 77string(29) "$2y$04$000000000000000000000$" 78string(2) "*0" 79bool(false) 80string(30) "$2y$04$0000000000000000000000$" 81string(60) "$2y$04$000000000000000000000u2a2UpVexIt9k3FMJeAVr3c04F5tcI8K" 82bool(false) 83