create a sha3_512 hash from a string in javascript

To create a SHA3-512 hash from a string in JavaScript, you can make use of the js-sha3 library.

You can start by installing the library using npm by running the following command:

index.tsx
npm install --save js-sha3
27 chars
2 lines

Then, you can use the keccak512 function provided by the library to generate the hash of a given string as follows:

const sha3_512 = require('js-sha3').sha3_512;

const message = 'hello world';
const hash = sha3_512(message);
console.log(hash);
129 chars
6 lines

This will output the SHA3-512 hash of the message "hello world".

gistlibby LogSnag