#!/usr/bin/env python3

import hashlib

def MD5(msg):
    m = hashlib.md5()
    m.update(msg.encode("utf-8"))
    return m.hexdigest()

# the string form htpasswd file:
HA1="ebff225e1ceb73e026fcc645af3e84f6"

nonce="sgIhliA3BgA=93e0dd849ec95fa55d43d0797c2cdfb0c2a2be78"
uri="/test"
qop="auth"
nonceCount="00000001"
cnonce="4fcb938b78ad9041"
method="GET"

HA2 = MD5(method+":"+uri)
response = MD5(HA1+":"+nonce+":"+nonceCount+":"+cnonce+":"+qop+":"+HA2)

print (f"{response=}")

