Skip to content

Instantly share code, notes, and snippets.

@alexanderGugel
Created November 5, 2014 16:20
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 alexanderGugel/d473ccc6270eba16cdcf to your computer and use it in GitHub Desktop.
Save alexanderGugel/d473ccc6270eba16cdcf to your computer and use it in GitHub Desktop.
Node.JS email to gravatar
var crypto = require('crypto');
var getGravatarImage = function (email) {
return ('//www.gravatar.com/avatar/' + md5(email)).trim();
};
var md5 = function (str) {
var hash = crypto.createHash('md5');
hash.update(str.toLowerCase().trim());
return hash.digest('hex');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment