Skip to content

Instantly share code, notes, and snippets.

@jammus
Created October 16, 2010 21:07
Show Gist options
  • Save jammus/630261 to your computer and use it in GitHub Desktop.
Save jammus/630261 to your computer and use it in GitHub Desktop.
var assert = require("assert");
var ntest = require("ntest");
var hashlib = require("hashlib");
var crypto = require("crypto");
ntest.describe("Crypto and Hashlib md5 hashes")
ntest.it("give same result for high characters", function() {
var trackname = "Tony’s Theme (Remastered)";
var cryptoHash = crypto.createHash("md5").update(trackname).digest("hex");
var hashlibHash = hashlib.md5(trackname);
assert.equal(cryptoHash, hashlibHash);
});
@jammus
Copy link
Author

jammus commented Oct 16, 2010

Output is:
TEST: Crypto and Hashlib md5 hashes give same result for high characters
AssertionError: "3bb37785865d7bc358729d0f9b773eae" == "27b8d7c08b2b6f5cbfcfff0c386bf9ff"
at Object. (cryptoVhashlib.js:11:12)
at [object Object].runTest (/usr/local/lib/node/ntest/index.js:153:14)
at [object Object].run (/usr/local/lib/node/ntest/index.js:171:21)
at [object Object].test (/usr/local/lib/node/ntest/index.js:132:9)
at Object. (/usr/local/lib/node/ntest/index.js:23:44)
at Object. (cryptoVhashlib.js:7:9)
at Module._compile (node.js:461:23)
at Module._loadScriptSync (node.js:468:10)
at Module.loadSync (node.js:338:12)
at loadModule (node.js:283:14)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment