Implementation of glibc crypt(3) MD5 password hashing method in TypeScript
npm install crypt3-md5Simple implementation of Crypt(3) MD5 hashing method from glibc fully written in TypeScript without any dependency.
The function allows to generate $1$ at the beginning of password hashes, and is fully compatible with crypt function in PHP.
``sh`
npm install crypt3-md5
š§ Hash password with salt
`ts
import { crypt } from 'crypt3-md5';
const cryptMd5 = crypt('password', '$1$abcdefgh$'); // '$1$abcdefgh$irWbblnpmw.5z7wgBnprh0'
`
Hash password without salt
`ts
import { crypt } from 'crypt3-md5';
const cryptMd5 = crypt('not salty password'); // '$1$$IObRb8Uen32kklOUL1C78.'
``
- Thanks for unknown user which developed the algorithm in JS and pasted it here.
- Also inspired with:
- https://code.activestate.com/recipes/325204-passwd-file-compatible-1-md5-crypt/
- https://www.npmjs.com/package/cryptmd5