The Hashing page has common functions related to data encryption(hashing)
npm install common-coding-tools@latest
Available Functions:
import {
makeHash,
verifyHash
} from "common-coding-tools/hashing"
Here is an example of how to use the makeHash
function:
const password="1234567"
const hashedPassword = makeHash( password , 4) // second argument any number
// output: 7101818432503545
// For more security of encryption use `.env` Secret number for 2nd argument
Here is an example of how to use the verifyHash
function:
const confirm_pass1 = "1234567"
const confirm_pass2 = "12345678"
const verifyPassword = verifyHash(confirm_pass1, hashedPassword, 4) // third args is same as makHash 2nd args
// output : true
const verifyPassword = verifyHash(confirm_pass2, hashedPassword, 4)
// output : false