blam / cryptmd5-for-javascript Goto Github PK
View Code? Open in Web Editor NEWJavaScript conversion of crypt_md5() (Original by Poul-Henning Kamp)
License: BSD 2-Clause "Simplified" License
JavaScript conversion of crypt_md5() (Original by Poul-Henning Kamp)
License: BSD 2-Clause "Simplified" License
This module does not treat strings correctly as binary. No return values are valid. You need to pass 'binary' to Hash.prototype.update
, or better yet, use Hash.prototype.digest
without an argument (you get a Buffer object instead of a string).
Test:
var cryptmd5 = require('cryptmd5');
var cp = require('child_process');
var salts = [ '0000', 'UwV8', '92AB', ' ' ];
var passwords = [ 'password', '$iB7-tZeYp', '5a;eDIaT6Fq-NQe9:Ypj', 'UHMQUbac:_F%I*?8;HkuJdjsoVtBjzJz.J6?S;$%9,wB.cn.AKV*zrFT&3V6FN8c' ];
salts.forEach(function(salt) {
passwords.forEach(function(password) {
var opensslResult = cp.execSync('openssl passwd -1 -salt "' + salt + '" "' + password + '"').toString().trim();
var cryptmd5Result = cryptmd5.cryptMD5(password, salt);
console.log(opensslResult, cryptmd5Result, opensslResult == cryptmd5Result ? 'SUCCESS' : 'FAILED');
});
});
Output:
$1$0000$aWwcZQIpZ/gD70N/fOUeh0 $1$0000$VtjqZ2dMBvsUmNcmmB1Er/ FAILED
$1$0000$xpuwLnUdN2/VgqV1upjQt. $1$0000$ex2.nm24yBAS3XGlKA60b1 FAILED
$1$0000$VVsZ2IjwX4v3spDLkCZsi/ $1$0000$dICRVw3Z6JLiBXSsFCwYM0 FAILED
$1$0000$JihTCFqGpBaZlIasx9cJ5/ $1$0000$3X7fya51Assg59llpHVkc0 FAILED
$1$UwV8$67M.3YMKh8ItI5.yhl2Zf/ $1$UwV8$khQeDiqg4YwEsGxgtduj20 FAILED
$1$UwV8$OhuhXlQvrBdWy4JjXneml. $1$UwV8$uxlS7CzJrekR3y.aRxelI/ FAILED
$1$UwV8$56rzDyLzsvjnH2MokZbrm/ $1$UwV8$6ufPuZ.0TrqpJWy4ttAHG/ FAILED
$1$UwV8$RQa12n7.dU.6upwj6GAkV1 $1$UwV8$u8MVnnJ8d7Yh7v3em54Ol. FAILED
$1$92AB$iMudtmg/UO2dhzZgBudkZ. $1$92AB$krAdB3zeYRH3wAXA51W4q0 FAILED
$1$92AB$QqZ6FsMqz3vz8I5G5fANX/ $1$92AB$IJVwiusUF79LG5.//eEOf1 FAILED
$1$92AB$1/Q9T0GVJfFcYz6U06jZ5. $1$92AB$E7NQo.JwLFfRx1pl2Tabb. FAILED
$1$92AB$kUZpMKw0PwWYMWdH69rtM. $1$92AB$QwgWY4UkWtVo4jgquZUPF0 FAILED
$1$ $XPcscamJTSm22xABupzQ1. $1$ $ijMahtW0Q.QMoyW9owq5F0 FAILED
$1$ $DKKvfQXvMMds4EFnGKQEe. $1$ $5HFfBZIoAuyYnxNwo7bem/ FAILED
$1$ $uvoJq39cchkkbuporqk2l1 $1$ $i7sNIdClAruCm/FZBAC3e/ FAILED
$1$ $/3965JlxdV8oXpaKAb4oY1 $1$ $0BhGzbd.v9e9ve.6EnEv6. FAILED
This package doesnt seem to be available on NPM but its all set up for it.
Mind throwing it in there?
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.