MCPcopy Create free account
hub / github.com/angular/angular / computeNativeSha256

Function computeNativeSha256

packages/common/http/test/transfer_cache_spec.ts:1153–1158  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

1151
1152 describe('generateHash', () => {
1153 async function computeNativeSha256(value: string): Promise<string> {
1154 const msgUint8 = new TextEncoder().encode(value);
1155 const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8);
1156 const hashArray = Array.from(new Uint8Array(hashBuffer));
1157 return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');
1158 }
1159
1160 it('should generate standard SHA-256 hashes matching Web Crypto specs', async () => {
1161 const testCases = [

Callers 1

Calls 4

mapMethod · 0.80
joinMethod · 0.65
toStringMethod · 0.65
digestMethod · 0.45

Tested by

no test coverage detected