Skip to content

Instantly share code, notes, and snippets.

@CypherpunkSamurai
Created November 7, 2021 18:38
Show Gist options
  • Save CypherpunkSamurai/d43c0d3a01871e8b7d07fdba828446a1 to your computer and use it in GitHub Desktop.
Save CypherpunkSamurai/d43c0d3a01871e8b7d07fdba828446a1 to your computer and use it in GitHub Desktop.
A Typescript Code to generate SHA1 hash with pure js jhash module
// uses jhash to generate SHA1 (https://www.npmjs.com/package/jhash)
// `npm install jhash`
var Hashes = require('jshashes');
var str = 'This is a sample text!';
new SHA1 instance and base64 string encoding
use SHA1.hex(str) for hex encoding
var SHA1 = new Hashes.SHA1().b64(str);
new Notice(SHA1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment