tu Nguyen

4 bundles
1 filea month ago
1

hash.js

12345678910111213141516
import sha256 from "crypto-js/sha256"; import hmacSHA512 from "crypto-js/hmac-sha512"; import Base64 from "crypto-js/enc-base64"; const nonce = ""; const privateKey = "tuns" export function hashPassword(password: string): string { try { const hashDigest = sha256(nonce + password); const hmacDigest = Base64.stringify(hmacSHA512("" + hashDigest, privateKey)); return hmacDigest; } catch (err) {} return password; }