Created
September 10, 2010 08:30
-
-
Save bpot/573312 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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