c9-core/node_modules/c9/hashing.js

14 wiersze
330 B
JavaScript
Czysty Zwykły widok Historia

2015-02-10 19:41:24 +00:00
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");
};