Skip to content
This repository was archived by the owner on Feb 15, 2022. It is now read-only.

User murmur instead of md5 #6

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: node_js
node_js:
- 4.1
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
var fs = require('graceful-fs')
var util = require('util')
var crypto = require('crypto')
var MurmurHash3 = require('imurmurhash');

function md5hex () {
var hash = crypto.createHash('md5')
function murmurhex () {
var hash = MurmurHash3('');
for (var ii=0; ii<arguments.length; ++ii) {
hash.update(''+arguments[ii])
hash.hash(hash+arguments[ii]);
}
return hash.digest('hex')
return hash.result();
}

var invocations = 0;
function getTmpname (filename) {
return filename + "." + md5hex(__filename, process.pid, ++invocations)
return filename + "." + murmurhex(__filename, process.pid, ++invocations)
}

module.exports = WriteStream
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"test": "test"
},
"dependencies": {
"graceful-fs": "^4.1.2"
"graceful-fs": "^4.1.2",
"imurmurhash": "^0.1.4"
},
"devDependencies": {
"tap": "^1.2.0"
Expand Down