-
-
Save chrisumbel/1193085 to your computer and use it in GitHub Desktop.
ASP.NET Membership password hash for Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var crypto = require('crypto'); | |
| console.log(dotnet_membership_password_hash("welcome1", "qkI2wRPSW7Y4ArqWkfHm5g==")); // W25/z6MAywBax7DITuKgSmsXua4= | |
| function dotnet_membership_password_hash(pass, salt) | |
| { | |
| var bytes = new Buffer(pass || '', 'ucs2'); | |
| var src = new Buffer(salt || '', 'base64'); | |
| var dst = new Buffer(src.length + bytes.length); | |
| src.copy(dst, 0, 0, src.length); | |
| bytes.copy(dst, src.length, 0, bytes.length); | |
| return crypto.createHash('sha1').update(dst).digest('base64'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment