Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible hash format for MSF Auth Hashing Algorithm (PBKDF2) for PHP #205

Open
Youdaman opened this issue Jun 8, 2018 · 1 comment

Comments

@Youdaman
Copy link

Youdaman commented Jun 8, 2018

Re https://github.com/alvyxaz/barebones-masterserver/wiki/MSF-Auth-Hashing-Algorithm-(PBKDF2)-for-PHP

As per https://github.com/defuse/password-hashing#hash-format the hash format is:

algorithm:iterations:hashSize:salt:hash

Whereas MSFSecruity.ValidatePassword and Msf.Client.Auth.Register use the format:

iterations:salt:hash
@Youdaman
Copy link
Author

Youdaman commented Jun 9, 2018

For anyone that's interested, here's a way to generate the hashed password in JavaScript/Node:

var crypto = require('crypto');

var password = "testing123";

var length = 24;
var iterations = 1000;
var algorithm = "sha1";

var salt = crypto.randomBytes(length);
var hash = crypto.pbkdf2Sync(password, salt, iterations, length, algorithm);

var msf2password = iterations + ":" + salt.toString('base64') + ":" + hash.toString('base64');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant