third_party/subscriptions-project/swg.js
/**
 * Returns a hexadecimal 128 character string that is the
 * SHA-512 hash of the passed string.
 * @param {string} stringToHash
 * @return {!Promise<string>}
 */
Returns a hexadecimal 128 character string that is the
SHA-512 hash of the passed string.
@param {string} stringToHash
@return {!Promise}
Returns a hexadecimal 128 character string that is the SHA - 512 hash of the passed string . @param { string } stringToHash @return { !Promise }
function hash(stringToHash) {
  const crypto = self.crypto || self.msCrypto;
  const subtle = crypto?.subtle;
  if (!subtle) {
    const message = 'Swgjs only works on secure (HTTPS or localhost) pages.';
    warn(message);
    return Promise.reject(message);
  }
  return subtle
    .digest('SHA-512', utf8EncodeSync(stringToHash))
    .then((digest) => toHex(digest));
}
function hash ( stringToHash ) { const crypto = self . crypto || self . msCrypto ; const subtle = crypto ?. subtle ; if ( ! subtle ) { const message = 'Swgjs only works on secure (HTTPS or localhost) pages.' ; warn ( message ) ; return Promise . reject ( message ) ; } return subtle . digest ( 'SHA-512' , utf8EncodeSync ( stringToHash ) ) . then ( ( digest ) => toHex ( digest ) ) ; }
Returns a hexadecimal 128 character string that is the
 SHA-512 hash of the passed string.
Returns a hexadecimal 128 character string that is the SHA - 512 hash of the passed string .