apache-md5
Advanced tools
Comparing version 1.0.4 to 1.0.5
// Crypto module import. | ||
var crypto = require('crypto'); | ||
var isOldNode = process.version.indexOf("v0.") == 0; | ||
var encoding = isOldNode ? null : 'ascii'; | ||
var MD5 = { | ||
@@ -20,3 +23,3 @@ itoa64: './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', | ||
if (inputSalt) { // Remove $apr1$ token and extract salt. | ||
salt = inputSalt.split("$")[2]; | ||
salt = inputSalt.split('$')[2]; | ||
} else { | ||
@@ -71,3 +74,3 @@ while(salt.length < 8) { // Random 8 chars. | ||
var ctx = password + magic + salt; | ||
var final = crypto.createHash('md5').update(password + salt + password).digest("binary"); | ||
var final = crypto.createHash('md5').update(password + salt + password, encoding).digest('binary'); | ||
@@ -86,3 +89,3 @@ for (var pl = password.length; pl > 0; pl -= 16) { | ||
final = crypto.createHash('md5').update(ctx).digest("binary"); | ||
final = crypto.createHash('md5').update(ctx, encoding).digest('binary'); | ||
@@ -109,6 +112,6 @@ // 1000 loop. | ||
// Final assignment after each loop. | ||
final = crypto.createHash('md5').update(ctxl).digest("binary"); | ||
final = crypto.createHash('md5').update(ctxl, encoding).digest('binary'); | ||
} | ||
return magic + salt + "$" + MD5.getPassword(final); | ||
return magic + salt + '$' + MD5.getPassword(final); | ||
} | ||
@@ -115,0 +118,0 @@ }; |
{ | ||
"name": "apache-md5", | ||
"description": "Node.js module for Apache style password encryption using md5.", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"author": "Gevorg Harutyunyan (http://github.com/gevorg)", | ||
@@ -6,0 +6,0 @@ "maintainers": [ |
@@ -0,0 +0,0 @@ # apache-md5 |
@@ -0,0 +0,0 @@ // Apache md5. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9041
110