var _ = require('lodash')
  , crypto = require('crypto')
  , qs = require('qs')
  , request = require('request')
  , sprintf = require('sprintf-js');

exports.hash = function (email) {
  email = email.replace(' ', '').toLowerCase();
  return crypto.createHash('md5').update(email).digest('hex');
};

exports.image = {
  url: function (hash, options) {
    var domain = options.secure ? 'https://secure.gravatar.com' : 'http://www.gravatar.com';
    var params = qs.stringify(_.reject(options, 'secure');
    return sprintf('%s/avatar/%s?%s', domain, hash, params);
  }
};

exports.profile = {
  data: function (hash, options, callback) {
    if (!callback) callback = options;

    var opts = {
      headers: {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'},
      json: true,
      url: this.url(hash, options)
    };

    request.get(opts, function (err, res, body) {
      if (res.statusCode !== 200) return callback(res.statusCode);
      callback(err, body);
    });
  },
  url: function (hash, options) {
    var domain = options.secure ? 'https://secure.gravatar.com' : 'http://www.gravatar.com';
    return sprintf('%s/%s.json', domain, hash);
  }
};
@@ -141,16 +141,24 @@
 ntf-js')
+.sprintf
 ;%0A%0Aexpor
@@ -186,16 +186,58 @@
 mail) %7B%0A
+  if (!~email.indexOf('@')) return email;%0A
   email 
@@ -370,36 +370,37 @@
  url: function (
-hash
+email
 , options) %7B%0A   
@@ -546,16 +546,17 @@
 secure')
+)
 ;%0A    re
@@ -595,20 +595,35 @@
 domain, 
-hash
+exports.hash(email)
 , params
@@ -663,36 +663,37 @@
 data: function (
-hash
+email
 , options, callb
@@ -921,20 +921,21 @@
 his.url(
-hash
+email
 , option
@@ -1119,20 +1119,21 @@
 nction (
-hash
+email
 , option
@@ -1271,20 +1271,35 @@
 domain, 
-hash
+exports.hash(email)
 );%0A  %7D%0A%7D

allow email or hash, bug fixes