Created
November 5, 2014 16:20
-
-
Save alexanderGugel/d473ccc6270eba16cdcf to your computer and use it in GitHub Desktop.
Node.JS email to gravatar
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 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