Node.js - encode text to SHA-1

0 points
Created by:

In this article, we would like to show how to encode text to SHA-1 in Node.js.

Using Node.js built-in module - Crypto

const crypto = require('crypto');

const data = 'dirask';
const sh1Data = crypto.createHash('sha1').update(data).digest('hex');

console.log(sh1Data) // 8867d36fe297487f78951976c6c3bd0653ffb05a


  1. SHA-1 - Wikipedia

Alternative titles

  1. Node.js - encoding SHA-1
  2. Node.js - hashing password SHA-1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Node.js - crypto module

Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂