def make_hash(data): h = md4.MD4() h.add(unknown_secret_prefix) h.add(data) return h.finish()
def md4_keyed_mac(message, key): return base64.b16encode(md4.MD4().add(key + message).finish()).lower()
def md4_hash(txt): MD = md4.MD4() MD.update(txt) return MD.digest()
def md4_states(txt): MD = md4.MD4() MD.update(txt, padding=False) return MD.int_states
def test_hmac(msg, hmac, regs=(0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476), length=0): return md4.MD4(SECURE_KEY + msg, regs, length).hexdigest() == hmac