(value: string)
| 1142 | |
| 1143 | describe('generateHash', () => { |
| 1144 | async function computeNativeSha256(value: string): Promise<string> { |
| 1145 | const msgUint8 = new TextEncoder().encode(value); |
| 1146 | const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8); |
| 1147 | const hashArray = Array.from(new Uint8Array(hashBuffer)); |
| 1148 | return hashArray.map((b) => b.toString(16).padStart(2, '0')).join(''); |
| 1149 | } |
| 1150 | |
| 1151 | it('should generate standard SHA-256 hashes matching Web Crypto specs', async () => { |
| 1152 | const testCases = [ |
no test coverage detected
searching dependent graphs…