mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-11-12 01:33:36 +01:00
fix: ensure correct input type for SHA-256 hashing in tests
This commit is contained in:
1 parent
86c8086979
commit
dd36fdde7a
1 file changed
+4
-1
@@ -19,7 +19,10 @@ const SAMPLE_PDF_SHA256 =
|
|||||||
'229defbb0cee6f02673a5cde290d0673e75a0dc31cec43989c8ab2a4eca7e1bb';
|
'229defbb0cee6f02673a5cde290d0673e75a0dc31cec43989c8ab2a4eca7e1bb';
|
||||||
|
|
||||||
async function sha256(data: Uint8Array): Promise<string> {
|
async function sha256(data: Uint8Array): Promise<string> {
|
||||||
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
|
const hashBuffer = await crypto.subtle.digest(
|
||||||
|
'SHA-256',
|
||||||
|
new Uint8Array(data)
|
||||||
|
);
|
||||||
return Array.from(new Uint8Array(hashBuffer))
|
return Array.from(new Uint8Array(hashBuffer))
|
||||||
.map((b) => b.toString(16).padStart(2, '0'))
|
.map((b) => b.toString(16).padStart(2, '0'))
|
||||||
.join('');
|
.join('');
|
||||||
|
|||||||
Reference in new issue
Block a user