def calcHA2(algo, pszMethod, pszDigestUri, pszQop, pszHEntity):
 m = algorithms[algo]()
 m.update(pszMethod)
 m.update(':')
 m.update(pszDigestUri)
 if (pszQop == 'auth-int'):
  m.update(':')
  m.update(pszHEntity)
 return m.digest().encode('hex')

def calcHA2 ( algo , pszMethod , pszDigestUri , pszQop , pszHEntity ) : m = algorithms [ algo ] ( ) m . update ( pszMethod ) m . update ( ':' ) m . update ( pszDigestUri ) if ( pszQop == 'auth-int' ) : m . update ( ':' ) m . update ( pszHEntity ) return m . digest ( ) . encode ( 'hex' )
compute h from rfc 2617 .