Skip to content

Instantly share code, notes, and snippets.

@bpot
Created September 10, 2010 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bpot/573312 to your computer and use it in GitHub Desktop.
Save bpot/573312 to your computer and use it in GitHub Desktop.
var msgpack = require('msgpack');
var fs = require('fs');
var crypto = require('crypto');
var hash = function(data) {
var h = crypto.createHash('md5');
h.update(data);
return h.digest('hex');
}
var data = fs.readFileSync(process.argv[2]);
console.log("orig: " + hash(data));
console.log("orig size: " + data.length);
console.log("unpacked: " + hash(msgpack.unpack(msgpack.pack(data))));
console.log("unpacked size: " + msgpack.unpack(msgpack.pack(data)).length);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment