Giter Site home page Giter Site logo

Determine which prefix we should use about bcrypt HOT 3 CLOSED

pyca avatar pyca commented on August 23, 2024
Determine which prefix we should use

from bcrypt.

Comments (3)

dstufft avatar dstufft commented on August 23, 2024

An important consideration, I'm pretty sure I selected $2a$ to maximize compatibility, particularly with py-bcrypt since $2y$ was custom to the C lib. However now that $2b$ is a "standard" prefix too, py-bcrypt might either support it as well, or it might be sane to say we want to pick theoretical security over comparability.

from bcrypt.

sarahbx avatar sarahbx commented on August 23, 2024

I'm currently implementing bcrypt password usage in a project and wanted to drop my two cents after reading through jazzyb's changes. The hashes in my system are accessed both by Python and PHP. Where $2y$ is the indicator that it is using the patched $2a$, should not $2y$ be the default output, with $2b$ or $2a$ as an option? Since I'm talking about compaitibility and just re-read your first post, I guess keeping $2a$ as default and either $2b$ or $2y$ as the options. Right now, $2a$ and $2y$(default output) are supported by the 'stable' PHP 5.5 library, where $2b$ is not. If $2b$ is algorithmically the same as $2y$, would it be better to stay compatible? And later updating the default to $2b$ when it is better supported?

php > $pwd = 'hello world';
php > $hasha = '$2a$12$CPeaPhxqTrBzJXP1KB1C/.t.2TJ7EzHhyCCmiLKAEKZovzmvdMwge';
php > $hashb = '$2b$12$CPeaPhxqTrBzJXP1KB1C/.t.2TJ7EzHhyCCmiLKAEKZovzmvdMwge';
php > $hashy = '$2y$12$CPeaPhxqTrBzJXP1KB1C/.t.2TJ7EzHhyCCmiLKAEKZovzmvdMwge';
php > var_dump(password_verify($pwd, $hasha));
bool(true)
php > var_dump(password_verify($pwd, $hashb));
bool(false)
php > var_dump(password_verify($pwd, $hashy));
bool(true)

from bcrypt.

sarahbx avatar sarahbx commented on August 23, 2024

I'm adding a check in my code to handle this issue if $2b$ becomes the default, but had I not seen this post, I would have had a lot of very unhappy users.

from bcrypt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.