MCPcopy Create free account
hub / github.com/Effect-TS/effect / makeHashDigest

Function makeHashDigest

packages/effect/src/unstable/workflow/internal/crypto.ts:4–15  ·  view source on GitHub ↗
(original: string)

Source from the content-addressed store, hash-verified

2
3/** @internal */
4export const makeHashDigest = (original: string) =>
5 Effect.map(
6 Effect.promise(() => crypto.subtle.digest("SHA-256", new TextEncoder().encode(original))),
7 (buffer) => {
8 const data = new Uint8Array(buffer)
9 let hexString = ""
10 for (let i = 0; i < 16; i++) {
11 hexString += data[i].toString(16).padStart(2, "0")
12 }
13 return hexString
14 }
15 )

Callers 2

Activity.tsFile · 0.90

Calls 3

digestMethod · 0.80
toStringMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected