Skip to content

Commit

Permalink
docs for makeX
Browse files Browse the repository at this point in the history
  • Loading branch information
sqs committed Apr 19, 2011
1 parent b7ab069 commit fb73423
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions core/srp.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ sjcl.keyexchange.srp = {
return group.g.powermod(x, group.N); return group.g.powermod(x, group.N);
}, },


/**
* Calculates SRP x.
* x = SHA1(<salt> | SHA(<username> | ":" | <raw password>)) [RFC 2945]
* @param {String} I The username.
* @param {String} P The password.
* @param {Object} s A bitArray of the salt.
* @return {Object} A bitArray of SRP x.
*/
makeX: function(I, P, s) { makeX: function(I, P, s) {
var inner; var inner = sjcl.hash.sha1.hash(I + ':' + P);
// From RFC 2945:
// x = SHA1(<salt> | SHA(<username> | ":" | <raw password>))
inner = sjcl.hash.sha1.hash(I + ':' + P);
return sjcl.hash.sha1.hash(sjcl.bitArray.concat(s, inner)); return sjcl.hash.sha1.hash(sjcl.bitArray.concat(s, inner));
}, },


Expand Down

0 comments on commit fb73423

Please sign in to comment.