What is apache-md5?
The apache-md5 npm package is used to create and verify Apache-style MD5 hashed passwords. This is particularly useful for applications that need to authenticate users against a password file used by Apache HTTP Server.
What are apache-md5's main functionalities?
Creating an Apache MD5 Hash
This feature allows you to create an Apache-style MD5 hash from a plain text password. The generated hash can be stored and used for password verification.
const apacheMD5 = require('apache-md5');
const hash = apacheMD5('password');
console.log(hash);
Verifying an Apache MD5 Hash
This feature allows you to verify a plain text password against an existing Apache-style MD5 hash. It returns a boolean indicating whether the password matches the hash.
const apacheMD5 = require('apache-md5');
const hash = apacheMD5('password');
const isMatch = apacheMD5('password', hash) === hash;
console.log(isMatch);
Other packages similar to apache-md5
bcrypt
bcrypt is a popular library for hashing passwords. It is more secure than MD5 as it includes a salt and is computationally intensive, making it resistant to brute-force attacks. Unlike apache-md5, bcrypt is widely used in modern applications for password hashing.
crypto
The crypto module is a built-in Node.js module that provides cryptographic functionality, including hashing algorithms like MD5. While it can generate MD5 hashes, it does not specifically create Apache-style MD5 hashes. It is more versatile but requires more setup for password hashing.
pbkdf2
pbkdf2 is another built-in Node.js module that provides the PBKDF2 (Password-Based Key Derivation Function 2) algorithm. It is more secure than MD5 and is recommended for password hashing. It includes a salt and multiple iterations to make brute-force attacks more difficult.
apache-md5
Node.js package for Apache style password encryption using md5..
Installation
Via git (or downloaded tarball):
$ git clone git://github.com/http-auth/apache-md5.git
Via npm:
$ npm install apache-md5
Usage
var md5 = require("apache-md5");
var encryptedPassword = md5("mypass");
console.log(md5("mypass", encryptedPassword) == encryptedPassword);
console.log(md5("notmypass", encryptedPassword) == encryptedPassword);
Running tests
It uses mocha, so just run following command in package directory:
$ npm test
Issues
You can find list of issues using this link.
Requirements
- Node.js - Event-driven I/O server-side JavaScript environment based on V8.
- npm - Package manager. Installs, publishes and manages node programs.
Development dependencies
- mocha - simple, flexible, fun javascript test framework for node.js & the browser.
- chai - BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.
License
The MIT License (MIT)
Copyright (c) 2016 Gevorg Harutyunyan
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.