MCPcopy Create free account
hub / github.com/deta/surf / generateHash

Function generateHash

packages/utils/src/data/crypto.ts:2–8  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

1// Generate a hash in the browser
2export const generateHash = (input: string) => {
3 const buffer = new TextEncoder().encode(input)
4 return crypto.subtle.digest('SHA-256', buffer).then((hash) => {
5 const hashArray = Array.from(new Uint8Array(hash))
6 return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('')
7 })
8}

Callers 3

createCodeResourceMethod · 0.90
getAppIdMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected