From 30e76bb16a9c8eb00fd2b5a9a329b83d804fe1ee Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Sat, 10 Oct 2026 13:22:11 -0300 Subject: [PATCH] benchmark: fix input passed to subtle.digest in webcrypto-digest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The data is already a random Buffer, so passing it through TextEncoder decoded it as UTF-8 and re-encoded it, making subtle.digest hash a different and larger input than createHash. Signed-off-by: RafaelGSS PR-URL: https://github.com/nodejs/node/pull/66608 Reviewed-By: Ulises Gascón Reviewed-By: Luigi Pinca --- benchmark/crypto/webcrypto-digest.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/benchmark/crypto/webcrypto-digest.js b/benchmark/crypto/webcrypto-digest.js index f5ef8e6bc49..e25181a3c3d 100644 --- a/benchmark/crypto/webcrypto-digest.js +++ b/benchmark/crypto/webcrypto-digest.js @@ -33,8 +33,6 @@ function measureLegacy(n, data, method) { } function measureSubtle(n, data, method) { - const ec = new TextEncoder(); - data = ec.encode(data); const jobs = new Array(n); bench.start(); for (let i = 0; i < n; i++)