public static string DigestCalcResponse(
string algorithm,
string username,
string realm,
string password,
string uri,
string nonce,
string nonceCount,
string cnonce,
string qop, // qop-value: "", "auth", "auth-int".
string method,
string digestURL,
string hEntity
)
{
string HA1 = DigestCalcHA1(username, realm, password);
string HA2 = DigestCalcHA2(method, uri);
string unhashedDigest= null;
if (nonceCount != null && cnonce != null && qop != null)
{
unhashedDigest = String.Format("{0}:{1}:{2}:{3}:{4}:{5}",
HA1,
nonce,
nonceCount,
cnonce,
qop,
HA2);
}
else
{
unhashedDigest = String.Format("{0}:{1}:{2}",
HA1,
nonce,
HA2);
}
return GetMD5HashBinHex(unhashedDigest);
}