Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update hash algorithm to sha256 #1

Merged
merged 4 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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