title: Using javascript `crypto.subtle` in synchronous function
body: <p>In javascript, is it possible to use the browser built-in sha256 hash (<a href="https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#Converting_a_digest_to_a_hex_string" rel="noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#Converting_a_digest_to_a_hex_string</a>) inside a synchronous function?</p>
  
  <p>Ideally, I'd like to do something like</p>
  
  <pre><code>String.prototype.sha256 = function() {
      // ...
      return hash
  }
  </code></pre>
  
  <p>I already tried things like <code>(async() =&gt; {hash = await digestMessage(message); return hash})()</code>, but I can only get back the promise object. </p>
  
  <p>It seems to me that it might not be possible to achieve what I want, but I thought I'll ask here before giving up. Thanks!</p>