nodejs createcipheriv invalid key length 1

nodejs createcipheriv invalid key length

let key = crypto.createHash('sha256').update(String(secret)).digest('base64').substr(0, 32);

Here is what the above code is Doing:
1. We’re importing the crypto module.
2. We’re creating a secret key.
3. We’re creating a hash of the secret key.
4. We’re creating a base64 encoded version of the hash.
5. We’re truncating the base64 encoded version of the hash to 32 characters.

Similar Posts