MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / digestMessage

Function digestMessage

apps/toolbox/src/pages/winter-tc.ts:23–28  ·  view source on GitHub ↗
(message)

Source from the content-addressed store, hash-verified

21 const text = 'An obscure body in the S-K System, your majesty. The inhabitants refer to it as the planet Earth.';
22
23 async function digestMessage(message) {
24 const encoder = new TextEncoder();
25 const data = encoder.encode(message);
26 const hash = await crypto.subtle.digest('SHA-256', data);
27 return hash;
28 }
29
30 digestMessage(text).then((digestBuffer) => {
31 console.log(digestBuffer.byteLength);

Callers 1

runFunction · 0.85

Calls 2

encodeMethod · 0.95
digestMethod · 0.45

Tested by

no test coverage detected