Using javascript `crypto.subtle` in synchronous function
问题 In javascript, is it possible to use the browser built-in sha256 hash (https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#Converting_a_digest_to_a_hex_string) inside a synchronous function? Ideally, I'd like to do something like String.prototype.sha256 = function() { // ... return hash } I already tried things like (async() => {hash = await digestMessage(message); return hash})() , but I can only get back the promise object. It seems to me that it might not be possible to