encrypter-util
v1.0.7
Published
library to encript and compare datas with node:crypto
Downloads
2
Maintainers
Readme
Encrypter
To use this library you needs to run something like this:
import { Encrypter } from 'encrypter-util';
const encrypter = new Encrypter();
const user = {
password: '1234'
}; // Your User Entity
const yourPassword = '1234';
user.password = encrypter.hashPassword(yourPassword); // Your user Password is now hashed
const compareBuffers = encrypter.comparePassword(user.password, yourPassword); // Compare user password to password given with user. Compares the underlying bytes that represent the givenArrayBuffer, TypedArray, or DataView instances using a constant-time algorithm.
console.log(
user.password, //password hashed
compareBuffers // true or false | compares the underlying bytes that represent the givenArrayBuffer, TypedArray, or DataView instances using a constant-time algorithm
);