Node యొక్క built-in crypto మాడ్యూల్ క్రిప్టోగ్రాఫిక్ ఫంక్షన్లను అందించે: hashing, encryption, random values, మరియు HMAC. అత్యంత ముఖ్యమైన ఆచరణాత్మక ఉపయోగం — password hashing — ఒక క్లిష్టమైన నియమం కలిగి ఉంది: పాస్వర్డ్ల కోసం ఎప్పుడూ fast, general-purpose hashes (MD5/SHA-256)ను ఉపయోగించవద్దు.
Password hashing: SLOW, salted algorithm ఉపయోగించండి
{ scrypt, randomBytes, timingSafeEqual } ;
{ promisify } ;
scryptAsync = (scrypt);
() {
salt = ().();
derived = (password, salt, );
;
}
() {
[salt, hash] = stored.();
derived = (password, salt, );
hashBuf = .(hash, );
(hashBuf, derived);
}
