MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / checksum

Function checksum

src/lib/installState.js:147–154  ·  view source on GitHub ↗

* Derives the checksum of a Buffer * @param {BufferSource} data * @returns the derived checksum

(data)

Source from the content-addressed store, hash-verified

145 * @returns the derived checksum
146 */
147async function checksum(data) {
148 const hashBuffer = await window.crypto.subtle.digest("SHA-256", data);
149 const hashArray = Array.from(new Uint8Array(hashBuffer));
150 const hashHex = hashArray
151 .map((byte) => byte.toString(16).padStart(2, "0"))
152 .join("");
153 return hashHex;
154}
155
156/**
157 *

Callers 1

isUpdatedMethod · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected