Key. This is sensitive information. Do not write it in plaintext in the source code.
Salt value. Note: For security purposes, the salt length should be greater than 8 bytes, and the salt should be a secure random number.
Dieda number. Note: More than 1000 iterations are recommended.
Length of the generated hash key. Note: The length is less than 32 bytes, which may be insecure in some cases.
Indicates the hash algorithm name.
import * as crypto from 'crypto';
import * as buffer from 'buffer';
let password = buffer.from("**********");
let salt = buffer.from("***********");
let crypt = crypto.pbkdf2(password, salt, 1000, 32, crypto.Hashs.SHA1);
console.log(crypt.toString(buffer.Encoding.Base64));
Pbkdf2 algorithm