13 - Hash and Compare Passwords Asynchronously - Information Security with HelmetJS - freeCodeCamp
Ganesh H
Since hashing is so computationally expensive, we should use async methods with callback functions to not block connections while they are taking place. bcrypt methods are async by default, and we can provide a callback function to continue after completion.
Link to Challenge : https://www.freecodecamp.org/learn/information-security/information-security-with-helmetjs/hash-and-compare-passwords-asynchronously Written Guide: https://www.notion.so/ganeshh123/Hash-and-Compare-Passwords-Asynchronously-2389ec5d63bb47a5af1f277232ffd4fc
Full Playlist for this course : https://www.youtube.com/playlist?list=PLhGp6N0DI_1TeEsQOdf1JmV8PnkQfEpQ4 All Writen Guides for this course : https://www.notion.so/ganeshh123/8ba82d9d1ff84c4583d6e9418ebe426b All My Tutorials can be found at : https://www.notion.so/Tutorials-Ganesh-H-293ea420d34a464f9a1907e0405b5f26
00:00 - Introduction 00:16 - Why we should hash asynchronously 00:37 - Hashing Asynchronously - bcrypt.hash() Generates a hash for the given input with the number of rounds, or salt specified. Runs asynchronously, and the callback function provided is executed after with the result. https://www.npmjs.com/package/bcrypt#to-hash-a-password 03:10 - Check a password Asynchronously - bcrypt.compare() Checks that the given hash (second argument) is valid for the given input (first argument). The number of salt rounds can be obtained from the hash. Runs asynchronously, and the callback function provided is executed after with the result. https://www.npmjs.com/package/bcrypt#to-check-a-password 05:35 - Challenge Solution
-————————————————————————————————————- HelmetJS is a type of middleware for Express-based applications that automatically sets HTTP headers to prevent sensitive information from unintentionally being passed between the server and client. While HelmetJS does not account for all situations, it does include support for common ones like Content Security Policy, XSS Filtering, and HTTP Strict Transport Security, among others. HelmetJS can be installed on an Express project from npm, after which each layer of protection can be configured to best fit the project.
freeCodeCamp (also referred to as “Free Code Camp”) is a non-profit organization that consists of an interactive learning web platform, an online community forum, chat rooms, online publications and local organizations that intend to make learning web development accessible to anyone. Beginning with tutorials that introduce students to HTML, CSS and JavaScript, students progress to project assignments that they complete either alone or in pairs. Upon completion of all project tasks, students are partnered with other nonprofits to build web applications, giving the students pr ... https://www.youtube.com/watch?v=vNfXPf-Ey8U
28111518 Bytes