Git Product home page Git Product logo

garden-password's Issues

MyBB password support is wrong

Hi! I found this trying to migrate from an old MyBB forum to vanilla.

I created password on my MyBB forum:
Password: testing user salt: PNjAshLI -> Hash: 0a26a9d4a87e66b104c1ec5143c87486
looking at the code from MyBB:
https://github.com/mybb/mybb/blob/c243e6a875467605d949dc6974c9da2e35549a93/inc/functions_user.php#L198

/**
 * Salts a password based on a supplied salt.
 *
 * @param string The md5()'ed password.
 * @param string The salt.
 * @return string The password hash.
 */
function salt_password($password, $salt)
{
	return md5(md5($salt).$password);
}

looks like salt_password ended as hashRaw function here
https://github.com/vanilla/garden-password/blob/master/src/MybbPassword.php#L23
however, this is wrong, as per the function description, password needs to be md5()'ed before.

after making this change:

/**
     * Hashes a password with a given salt.
     *
     * @param string $password The password to hash.
     * @param string $salt The password salt.
     * @return string Returns the password hash.
     */
    private function hashRaw($password, $salt) {
-        $calc_hash = md5(md5($salt).$password);
+       $calc_hash = md5(md5($salt).md5($password));
        return $calc_hash;
    }

it worked like a charm

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.