From bd119508dbc4736a8322818f6ed1ec4a407cbe9a Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Fri, 19 Dec 2025 23:30:52 -0800 Subject: [PATCH] Simplify ArrayBuffer to base64 conversion https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/toBase64 https://caniuse.com/mdn-javascript_builtins_uint8array_tobase64 --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 1caaa24..7753038 100644 --- a/index.html +++ b/index.html @@ -195,7 +195,7 @@ const hashPromises = []; for (const algo of ['SHA-256', 'SHA-384', 'SHA-512']) { hashPromises.push(crypto.subtle.digest(algo, buffer) - .then(hash => `${algo.replace('-', '').toLowerCase()}-${btoa(String.fromCharCode(...new Uint8Array(hash)))}`) + .then(hash => `${algo.replace('-', '').toLowerCase()}-${new Uint8Array(hash).toBase64()}`) .then(sri => cache[url][algo] = sri) ); } -- 2.47.3