From 28b77231ca25824688d1a226639740e5516f1bbf Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Wed, 25 Feb 2026 15:10:00 -0800 Subject: [PATCH 1/2] fix: use node:crypto instead of imurmurhash --- lib/index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/index.js b/lib/index.js index 6013894..d470cdd 100644 --- a/lib/index.js +++ b/lib/index.js @@ -5,7 +5,7 @@ module.exports._getTmpname = getTmpname // for testing module.exports._cleanupOnExit = cleanupOnExit const fs = require('fs') -const MurmurHash3 = require('imurmurhash') +const crypto = require('node:crypto') const { onExit } = require('signal-exit') const path = require('path') const { promisify } = require('util') @@ -28,11 +28,13 @@ const threadId = (function getId () { let invocations = 0 function getTmpname (filename) { return filename + '.' + - MurmurHash3(__filename) - .hash(String(process.pid)) - .hash(String(threadId)) - .hash(String(++invocations)) - .result() + crypto.createHash('sha1') + .update(__filename) + .update(String(process.pid)) + .update(String(threadId)) + .update(String(++invocations)) + .digest() + .readUInt32BE(0) } function cleanupOnExit (tmpfile) { From e5219a857495e8aeaf096b608e8f03b131c0c253 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Wed, 25 Feb 2026 15:10:41 -0800 Subject: [PATCH 2/2] deps: remove imurmurhash --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 75611ec..6940998 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ }, "homepage": "https://github.com/npm/write-file-atomic", "dependencies": { - "imurmurhash": "^0.1.4", "signal-exit": "^4.0.1" }, "devDependencies": {