New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

drupal-hash

Package Overview
Dependencies
Maintainers
11
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drupal-hash - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

13

index.js

@@ -156,3 +156,14 @@ var crypto = require('crypto');

}
return (hashed && stored_hash == hashed);
// Use a constant time comparison to prevent timing attacks.
if (hashed) {
var mismatch = hashed.length === stored_hash.length ? 0 : 1;
for (var i = 0, l = hashed.length; i < l; ++i) {
mismatch |= (hashed.charCodeAt(i) ^ stored_hash.charCodeAt(i));
}
return mismatch === 0;
}
else {
return false;
}
}

@@ -159,0 +170,0 @@

2

package.json
{
"name": "drupal-hash",
"version": "1.0.3",
"version": "1.0.4",
"description": "JavaScript implementation of the hashing algorithm used in Drupal",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -78,3 +78,21 @@ var expect = require('chai').expect;

});
describe('When the password hash is longer than the calculated hash', function() {
var longPasswordHash = passwordHash + 'abcd';
var result = drupalHash.checkPassword(password, longPasswordHash);
it('Then the result should be false', function() {
expect(result).to.be.false;
});
});
describe('When the password hash is shorter than the calculated hash', function() {
var shortPasswordHash = passwordHash.substr(0, passwordHash.length - 3);
var result = drupalHash.checkPassword(password, shortPasswordHash);
it('Then the result should be false', function() {
expect(result).to.be.false;
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc