diff --git a/core/srp.js b/core/srp.js index 814f3245..6b0dd248 100644 --- a/core/srp.js +++ b/core/srp.js @@ -17,11 +17,16 @@ sjcl.keyexchange.srp = { return group.g.powermod(x, group.N); }, + /** + * Calculates SRP x. + * x = SHA1( | SHA( | ":" | )) [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( | SHA( | ":" | )) - 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)); },