hmac.digest()
hmac.digest() is a Python method in the Hmac Module category. Returns the digest as bytes. The syntax is hmac.digest(). Returns: Bytes digest. A typical example: h = hmac.new(b"key", b"msg", "sha256")
h.digest() # b"\x8e... (raw bytes)". A close sibling is hmac.new(), which creates a new HMAC object for message authentication. A close sibling is hmac.hexdigest(), which returns the digest as a hexadecimal string. A close sibling is hmac.update(), which updates the HMAC object with additional data. A close sibling is hmac.compare_digest(), which constant-time comparison to prevent timing attacks. More about this category: HMAC message authentication — new, digest, hexdigest, compare_digest. Related Hmac Module entries: hmac.new(), hmac.hexdigest(), hmac.update(), hmac.compare_digest(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try hmac.digest() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.