Skip to content

Instantly share code, notes, and snippets.

@stefan2904
Created October 2, 2016 17:04
Show Gist options
  • Select an option

  • Save stefan2904/c8a81bd40c9245f99455a244f8a64541 to your computer and use it in GitHub Desktop.

Select an option

Save stefan2904/c8a81bd40c9245f99455a244f8a64541 to your computer and use it in GitHub Desktop.
PHP's bcrypt ...
<?php
$options = ['salt' => "m7z6odpn/jenmx0ablkhge"];
// PHP's bcrypt implementation ignores input after binary-zero. So ...
echo password_hash("a\0", PASSWORD_DEFAULT, $options) . "\n";
echo password_hash("a\0bcd", PASSWORD_DEFAULT, $options) . "\n";
echo password_hash("a\0bcdasdasdads", PASSWORD_DEFAULT, $options) . "\n";
echo password_hash("a\0aaa", PASSWORD_DEFAULT, $options) . "\n";
// ... return the same hash!
// see http://blog.ircmaxell.com/2015/03/security-issue-combining-bcrypt-with.html
?>
$2y$10$m7z6odpn/jenmx0ablkhge07wnzTKOYEH4K5r.ZrRyWNtQw31XUp6
$2y$10$m7z6odpn/jenmx0ablkhge07wnzTKOYEH4K5r.ZrRyWNtQw31XUp6
$2y$10$m7z6odpn/jenmx0ablkhge07wnzTKOYEH4K5r.ZrRyWNtQw31XUp6
$2y$10$m7z6odpn/jenmx0ablkhge07wnzTKOYEH4K5r.ZrRyWNtQw31XUp6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment