Skip to content

Commit

Permalink
Merge branch 'master' of github.com:visionmedia/node-cookie-signature
Browse files Browse the repository at this point in the history
  • Loading branch information
natevw committed Jun 25, 2014
2 parents 540caea + 4cc5e21 commit 3979108
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion index.js
Expand Up @@ -39,5 +39,13 @@ exports.unsign = function(val, secret){
var str = val.slice(0, val.lastIndexOf('.'))
, mac = exports.sign(str, secret);

return exports.sign(mac, secret) == exports.sign(val, secret) ? str : false;
return sha1(mac) == sha1(val) ? str : false;
};

/**
* Private
*/

function sha1(str){
return crypto.createHash('sha1').update(str).digest('hex');
}

0 comments on commit 3979108

Please sign in to comment.