vanilla / garden-password Goto Github PK
View Code? Open in Web Editor NEWA common interface for password hashing algorithms.
License: MIT License
A common interface for password hashing algorithms.
License: MIT License
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.