title: double hashing sha256 NOTworking!! + how to convert to hex?
body: <p>so I've been trying to mirror the double hashing using SHA256 in Google Script, and I am not able to replicate the second hash.  The first one gets replicated correctly, but then something must be off with that first hash being plugged into the next digest.</p>
  
  <pre><code>  var teststring = "hello";
  
    var firsthash=Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, teststring); 
  
    var secondhash=Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, firsthash);
  
    app.getElementById('balancelabel').setText("result: "+secondhash);
  </code></pre>
  
  <p>I then look up first hash and second hash on an online converter.  First hash matches the below expectation, and the second doesn't.  I have tried so many things to try to modify firsthash variable but can't seem to make it work.  </p>
  
  <p>This is what the hashes should be:
  hello
  2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 (first round of sha-256)
  9595c9df90075148eb06860365df33584b75bff782a510c6cd4883a419833d50 (second round of sha-256)</p>
  
  <p>I have also been trying really hard to get that byte hash and produce a hex encoded string (not base64, which Google Script does seem to support out of the box).  </p>
  
  <p>Can someone PLEASE HELP?</p>
  
  <p>EDIT:  It appears impossible using Utitilies.computeDigest because it only accepts string as input.  However, I just checked that I can implement this JS sha256 function in Google Script.  How would I do a double hash using byte input of the first hash?</p>
  
  <p><a href="http://www.movable-type.co.uk/scripts/sha256.html" rel="nofollow">SHA256 JavaScript function</a></p>