MCPcopy Index your code
hub / github.com/ClearURLs/Addon / sha256

Function sha256

core_js/tools.js:324–330  ·  view source on GitHub ↗

* This method calculates the SHA-256 hash as HEX string of the given message. * This method uses the native hashing implementations of the SubtleCrypto interface which is supported by all browsers * that implement the Web Cryptography API specification and is based on: * https://developer.mozilla

(message)

Source from the content-addressed store, hash-verified

322 * @returns {Promise<string>} SHA-256 of the given message
323 */
324async function sha256(message) {
325 const msgUint8 = enc.encode(message);
326 const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8);
327 const hashArray = Array.from(new Uint8Array(hashBuffer));
328
329 return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
330}
331
332/**
333 * Generates a non-secure random ASCII string of length {@code len}.

Callers 1

fetchFromURLFunction · 0.85

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected