On this page
  1. hmac.compare_digest
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

hmac.compare_digest

Up: hmac | Next: hmac.digest
Rel: hmac.digest, hmac.HMAC, hmac.new
Ref: docs.python.org — hmac.compare_digest
Tags: #public #python3 #stdlib #hmac


Import

import hmac
from hmac import compare_digest

Signature & Overview

hmac.compare_digest(a, b, /)

Return 'a == b'.

Usage

import hmac

assert hmac.compare_digest(b"abc", b"abc") is True
assert hmac.compare_digest(b"abc", b"abd") is False

Gotchas

REPL Inspect

from hmac import compare_digest
help(compare_digest)

Linked from

Related notes