Skip to content

Commit

Permalink
Merge pull request #1 from Automattic/update/gravatar-hash-alg
Browse files Browse the repository at this point in the history
Update hash algorithm to sha256
  • Loading branch information
jgcaruso authored Jul 26, 2023
2 parents 1689413 + f2001c4 commit 888ee0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Module dependencies.
*/

var md5 = require('md5');
var sha256 = require('js-sha256');
var jsonp = require('jsonp');
var querystring = require('querystring');

Expand All @@ -19,7 +19,7 @@ exports.url = function (email, config) {
config = config || {};
var qs = querystring.stringify(config);
var qs = qs === '' ? '' : '?' + qs;
var url = 'https://secure.gravatar.com/avatar/' + md5(email.trim().toLowerCase()) + qs;
var url = 'https://secure.gravatar.com/avatar/' + sha256(email.trim().toLowerCase()) + qs;
return url;
};

Expand All @@ -32,7 +32,7 @@ exports.url = function (email, config) {
*/

exports.profile = function (email, fn) {
var url = 'https://secure.gravatar.com/' + md5(email.trim().toLowerCase());
var url = 'https://secure.gravatar.com/' + sha256(email.trim().toLowerCase());
jsonp(url + '.json', function (err, obj) {
if (err) return fn(err);
if (obj && obj.entry) {
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
"description": "Simple browser implementation of the Gravatar API",
"version": "1.1.1",
"dependencies": {
"md5-component": "0.0.1",
"jsonp": "0.1.0",
"component-querystring": "1.3.2"
"component-querystring": "2.0.1",
"js-sha256": "0.9.0",
"jsonp": "0.1.0"
},
"browser": {
"md5": "md5-component",
"querystring": "component-querystring"
},
"component": {
Expand Down

0 comments on commit 888ee0a

Please sign in to comment.