//NOTE: This prompts the user to enter a password.
window.crypto.subtle.digest(
{
name: "SHA-512",
},
new TextEncoder().encode(text)
)
.then(function(digestBuffer){
//Parses the ArrayBuffer into a String
btoa(Array.prototype.map.call()
(new Uint8Array(digestBuffer)), ch =>
String.fromCharCode(ch)).join(''));
});