// Import 'crypto' module
const crypto = require('crypto');
// Example password
const password = 'mypassword';
// Create SHA-256 hash of the password
const hash = crypto.createHash('sha256').update(password).digest('hex');
// Log the generated hash
console.log('Hash:', hash);Hashing Password with SHA-256 using 'crypto' module
Related Posts
More content you might like
Build a Custom Rate Limiter in Node.js with Redis
After 100 requests within an hour, you’ll get:
{
"error": "Too many requests. Try later."
}Building a Real-Time Chat Application with WebSockets in Node.js
In this tutorial, we will create a real-time chat application using Node.js and WebSockets. Real-time communication is a crucial aspect of modern web applications, allowing users to interact with each other instantaneously. By leveraging WebSockets, we can establish a persistent connection between the client and server, enabling seamless data exchange.
WebSockets provide a full-duplex communication channel over a single TCP connection, allowing both the client and server to send messages at any time. Unlike HTTP, WebSockets maintain a persistent connection, making them ideal for applications requiring real-time updates, such as chat apps, online gaming, and live notifications.
JWT Token Creation and Verification in Node.js using 'jsonwebtoken'
No preview available for this content.
Simple HTTP Server in Node.js
No preview available for this content.
Discussion 0
Please sign in to join the discussion.
No comments yet. Be the first to share your thoughts!