3v4l.org

run code in 300+ PHP versions simultaneously
<?php function doHash($string) { if ($string == "") return ""; $passwordChars = "abcdefghijklmnopqrstuvwxyz_"; $hashChars = "0123456789ABCDEF"; $hashedString = ""; $hashArray = Array(32); for($i=0; $i<32; $i++) $hashArray[$i]=GetCharacterKey($string, $i); for ($i=0; $i<32; $i++) { if (strpos($passwordChars, substr($string, $i%strlen($string), 1)) == -1) $string= substr($string, 0, $i%strlen($string)) . "_" . substr($string, ($i%strlen($string))+1, (strlen($string)-($i%strlen($string)))-1); $hashArray[$i] += (floor(strpos($passwordChars, substr($string, $i%strlen($string), 1))/9)*16 + floor(strpos($passwordChars, substr($string, $i%strlen($string), 1))%9/3)*4 + floor(strpos($passwordChars, substr($string, $i%strlen($string), 1))%3)); for ($j=0; $j<3; $j++){ if (($hashArray[$i]&(48>>($j*2))) == (32>>($j*2)) && (GetCharacterKey($string, $i)&(1<<$j))==(1<<$j)) { $hashArray[i]=($hashArray[$i]&(255-(48>>($j*2)))) + (48>>($j*2)); } } for ($j=0; $j<2; $j++) { $hashArray[$i] += floor($hashArray[($i+$j)%32]/1234)*pow(4,$j+3); } $doubleByteHashNumber = 0; for ($j=0; $j<16; $j++){ $doubleByteHashNumber += (($hashArray[$i]&pow(2,($j*2)+($i%2)))>>($j+($i%2))); } $hashArray[$i] = $doubleByteHashNumber; echo ($hashArray[$i]&65280)>>8 . " "; echo ($hashArray[$i]&255) . "\n"; $hashedString .= substr($hashChars, floor((($hashArray[$i]&65280)>>8)/16), 1); $hashedString .= substr($hashChars, floor((($hashArray[$i]&65280)>>8)%16), 1); $hashedString .= substr($hashChars, floor(($hashArray[$i]&255)/16), 1); $hashedString .= substr($hashChars, floor(($hashArray[$i]&255)%16), 1); } return $hashedString; } function GetCharacterKey($string, $character) { $passwordChars = "abcdefghijklmnopqrstuvwxyz_"; $key = strpos($passwordChars, $string[$character%strlen($string)]); for($i=0; $i<10+strlen($string)+($character*3); $i++) { $key = ($key<<1); $key %= 2147483648; $key += strpos($passwordChars, $string[$i%strlen($string)]); $key = floor(sin($key)*1000000); } if ($key < 0) { return -(2147483648 - ($key & 2147483584)); } else { return ($key & 2147483584); } } echo doHash("ab"); ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
254 64 2 32 2 200 2 128 5 176 2 104 2 232 252 16 1 216 253 64 0 104 252 160 254 208 2 160 3 48 2 192 252 56 255 224 254 216 0 32 1 152 3 72 252 96 1 152 3 160 254 144 2 248 255 216 253 208 252 16 0 88 3 56 FE40022002C8028005B0026802E8FC1001D8FD400068FCA0FED002A0033002C0FC38FFE0FED8002001980348FC60019803A0FE9002F8FFD8FDD0FC1000580338
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 254 64 2 32 2 200 2 128 5 176 2 104 2 232 252 16 1 216 253 64 0 104 252 160 254 208 2 160 3 48 2 192 252 56 255 224 254 216 0 32 1 152 3 72 252 96 1 152 3 160 254 144 2 248 255 216 253 208 252 16 0 88 3 56 FE40022002C8028005B0026802E8FC1001D8FD400068FCA0FED002A0033002C0FC38FFE0FED8002001980348FC60019803A0FE9002F8FFD8FDD0FC1000580338
Output for 7.4.0 - 7.4.33
Deprecated: The behavior of unparenthesized expressions containing both '.' and '>>'/'<<' will change in PHP 8: '<<'/'>>' will take a higher precedence in /in/slPL7 on line 43 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 25464 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 232 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 2200 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 2128 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 5176 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 2104 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 2232 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 25216 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 1216 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 25364 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 0104 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 252160 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 254208 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 2160 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 348 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 2192 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 25256 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 255224 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 254216 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 032 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 1152 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 372 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 25296 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 1152 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 3160 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 254144 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 2248 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 255216 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 253208 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 25216 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 088 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 356 FE40022002C8028005B0026802E8FC1001D8FD400068FCA0FED002A0033002C0FC38FFE0FED8002001980348FC60019803A0FE9002F8FFD8FDD0FC1000580338
Output for 5.5.0 - 5.5.35, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.3.32 - 7.3.33
25464 232 2200 2128 5176 2104 2232 25216 1216 25364 0104 252160 254208 2160 348 2192 25256 255224 254216 032 1152 372 25296 1152 3160 254144 2248 255216 253208 25216 088 356 FE40022002C8028005B0026802E8FC1001D8FD400068FCA0FED002A0033002C0FC38FFE0FED8002001980348FC60019803A0FE9002F8FFD8FDD0FC1000580338
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31
Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 25464 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 232 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 2200 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 2128 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 5176 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 2104 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 2232 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 25216 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 1216 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 25364 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 0104 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 252160 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 254208 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 2160 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 348 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 2192 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 25256 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 255224 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 254216 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 032 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 1152 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 372 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 25296 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 1152 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 3160 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 254144 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 2248 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 255216 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 253208 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 25216 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 088 Notice: A non well formed numeric value encountered in /in/slPL7 on line 43 356 FE40022002C8028005B0026802E8FC1001D8FD400068FCA0FED002A0033002C0FC38FFE0FED8002001980348FC60019803A0FE9002F8FFD8FDD0FC1000580338

preferences:
217.84 ms | 410 KiB | 257 Q