From 62b683c4c3cdb706e84d1640b82eb4de3b42131e Mon Sep 17 00:00:00 2001 From: Gustavo Rodrigues Date: Thu, 12 Sep 2024 19:29:20 -0300 Subject: [PATCH] Pad hashes with zeroes when needed --- src/dhash.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dhash.ts b/src/dhash.ts index 092b61c..35837fb 100644 --- a/src/dhash.ts +++ b/src/dhash.ts @@ -35,7 +35,7 @@ export const dhash = async (pathOrSrc: string | Uint8Array) => { } } - return parseInt(out.join(""), 2).toString(16); + return parseInt(out.join(""), 2).toString(16).padStart(16, 0); }; export const compare = (hash1: string, hash2: string) => {