docs for makeX

This commit is contained in:
Quinn Slack 2011-04-19 16:26:59 -07:00
parent 57da29902f
commit c085b773b7
1 changed files with 9 additions and 4 deletions

View File

@ -17,11 +17,16 @@ sjcl.keyexchange.srp = {
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) {
var inner;
// From RFC 2945:
// x = SHA1(<salt> | SHA(<username> | ":" | <raw password>))
inner = sjcl.hash.sha1.hash(I + ':' + P);
var inner = sjcl.hash.sha1.hash(I + ':' + P);
return sjcl.hash.sha1.hash(sjcl.bitArray.concat(s, inner));
},