Skip to content

Instantly share code, notes, and snippets.

Created Sep 24, 2019
What would you like to do?
const sha256 = async message => {
const msgBuffer = new TextEncoder('utf-8').encode(message);
const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
const hashArray = Array.from(new Uint8Array(hashBuffer));
return => ('00' + b.toString(16)).slice(-2)).join('');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment