core/node_modules/c9/hashing.js
2015-02-10 23:41:24 +04:00

14 lines
330 B
JavaScript

var Crypto = require("crypto");
/**
* Return md5 hash of the given string and optional encoding,
* defaulting to hex.
*
* @param {String} str
* @param {String} encoding
* @return {String}
* @api public
*/
exports.md5 = function(str, encoding){
return Crypto.createHash("md5").update(str).digest(encoding || "hex");
};