# digcalc.h

Summary

digcalc.h |
Functions |
CvtHex | Convert hash value to hexa string
DigestCalcHA1 | Calculate HA1 as defined in HTTP digest specification
DigestCalcResponse | Calculate request-digest/response-digest as defined in HTTP Digest specification

### Functions

### CvtHex

#### Purpose

Convert hash value to hexa string

#### Parameters

Bin | in <HASH> - hash value to be converted
Hex | out <HASHHEX> - HEXA value of hash

#### Return Value

-

#### Errors

-

#### Detailed description

-

### DigestCalcHA1

#### Purpose

Calculate HA1 as defined in HTTP digest specification

#### Parameters

pszAlg | in charstring - a string indicating a pair of algorithms used to produce the digest and a checksum
pszUserName | in charstring - user name
pszRealm | in charstring - user realm
pszPassword | in charstring - user password
pszpwdlen | in integer - lenght of the user password
pszNonce | in charstring - a server-specified data string which may be uniquely generated each time a 401 response is made
pszCNonce | in charstring - client nonce
SessionKey | out <HASHHEX> - HEXA value of hash HA1

#### Return Value

-

#### Errors

-

#### Detailed description

HA1 = MD5(A1) = MD5(username:realm:password)

#### If algorithm (pszAlg) is md5-sess

HA1 = MD5(HA1:nonce:cNonce)

### DigestCalcResponse

#### Purpose

Calculate request-digest/response-digest as defined in HTTP Digest specification

#### Parameters

pszNonce | in charstring - nonce
pszNonceCount | in charstring - nonce count
pszCNonce | in charstring - client nonce
pszQop | in charstring - qop-value: “”, “auth”, “auth-int”
pszMethod | in charstring - method (from the request)
pszDigestUri | in charstring - digest URI
HEntity | in charstring - H(entity body) if qop=”auth-int”
Response | out <HASHHEX> - HEXA Digest response

#### Return Value

-

#### Errors

-

#### Detailed description

Default: HA2 = MD5(A2) = MD5(method:digestURI)

#### If qop is “auth-init”

HA2 = MD5(method:digestURI:HEntity)

Default: response = MD5(HA1:nonce)

#### If Qop is not empty string

response = MD5(HA1:nonce:nonceCount:cNonce:Qop:HA2)