Skip to content

Instantly share code, notes, and snippets.

@merih
Last active August 29, 2015 14:04
Show Gist options
  • Save merih/5e9e296f25c3304ca9f6 to your computer and use it in GitHub Desktop.
Save merih/5e9e296f25c3304ca9f6 to your computer and use it in GitHub Desktop.
WebCrypto SHA-256 digest + TextEncoder/TextDecoder + Promises + Array.from + Arrow Functions
window.crypto.subtle.digest({
name: "SHA-256"
}, new TextEncoder().encode("Hello, World!"))
.then(x => console.log(Array.from(x).map(y => y.toString(16)).join("")));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment