Giter Site home page Giter Site logo

Comments (4)

charmander avatar charmander commented on July 21, 2024

The check uses a $2a$ hash where the behaviour is maintained for compatibility:

switch ((minor = salt[1])) {
case 'a':
    key_len = (u_int8_t)(strlen(key) + 1);
    break;
case 'b':
    /* strlen() returns a size_t, but the function calls
     * below result in implicit casts to a narrower integer
     * type, so cap key_len at the actual maximum supported
     * length here to avoid integer wraparound */
    key_len = strlen(key);
    if (key_len > 72)
        key_len = 72;
    key_len++; /* include the NUL */
    break;
⋮

from bcrypt.

dstufft avatar dstufft commented on July 21, 2024

I think maintaining compatibility for this is kind of bonkers, but in any case, prior to 3.0 we had the fix even for $2a in this library, so we should restore said fix.

from bcrypt.

reaperhulk avatar reaperhulk commented on July 21, 2024

@dstufft do you have an opinion on how we should fix this to have it behave the same as bcrypt 2.0.0? Could we take all input passwords and do password = password[:72]?

from bcrypt.

dstufft avatar dstufft commented on July 21, 2024

Truncating to 72 seems reasonable, since that's all the C code is going to do anyways in the correct case.

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.