Skip to content
Permalink
Browse files

JsSIP.Utils.MD5() renamed to JsSIP.Utils.calculateMD5() (a more prope…

…r name for a function).
  • Loading branch information
ibc committed Feb 20, 2013
1 parent 2d2255f commit 7f523cc49f4aa9517482bddbb0d10436fae65f25
Showing with 6 additions and 6 deletions.
  1. +5 −5 src/DigestAuthentication.js
  2. +1 −1 src/Utils.js
@@ -57,23 +57,23 @@ JsSIP.DigestAuthentication.prototype.authenticate = function(password) {
}

// HA1 = MD5(A1) = MD5(username:realm:password)
ha1 = JsSIP.Utils.MD5(this.username + ":" + this.realm + ":" + password);
ha1 = JsSIP.Utils.calculateMD5(this.username + ":" + this.realm + ":" + password);

if (this.qop === 'auth' || this.qop === null) {
// HA2 = MD5(A2) = MD5(method:digestURI)
ha2 = JsSIP.Utils.MD5(this.method + ":" + this.uri);
ha2 = JsSIP.Utils.calculateMD5(this.method + ":" + this.uri);

} else if (this.qop === 'auth-int') {
// HA2 = MD5(A2) = MD5(method:digestURI:MD5(entityBody))
ha2 = JsSIP.Utils.MD5(this.method + ":" + this.uri + ":" + JsSIP.Utils.MD5(this.body ? this.body : ""));
ha2 = JsSIP.Utils.calculateMD5(this.method + ":" + this.uri + ":" + JsSIP.Utils.calculateMD5(this.body ? this.body : ""));
}

if(this.qop === 'auth' || this.qop === 'auth-int') {
// response = MD5(HA1:nonce:nonceCount:credentialsNonce:qop:HA2)
this.response = JsSIP.Utils.MD5(ha1 + ":" + this.nonce + ":" + this.decimalToHex(this.nc) + ":" + this.cnonce + ":" + this.qop + ":" + ha2);
this.response = JsSIP.Utils.calculateMD5(ha1 + ":" + this.nonce + ":" + this.decimalToHex(this.nc) + ":" + this.cnonce + ":" + this.qop + ":" + ha2);
} else {
// response = MD5(HA1:nonce:HA2)
this.response = JsSIP.Utils.MD5(ha1 + ":" + this.nonce + ":" + ha2);
this.response = JsSIP.Utils.calculateMD5(ha1 + ":" + this.nonce + ":" + ha2);
}

return this.toString();
@@ -185,7 +185,7 @@ JsSIP.Utils= {
},

// MD5 (Message-Digest Algorithm) http://www.webtoolkit.info
MD5: function(string) {
calculateMD5: function(string) {
function RotateLeft(lValue, iShiftBits) {
return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
}

0 comments on commit 7f523cc

Please sign in to comment.
You can’t perform that action at this time.