Skip to content

Commit

Permalink
Show show to compare digest() to crc32c()
Browse files Browse the repository at this point in the history
Signed-off-by: Rodrigo Tobar <[email protected]>
  • Loading branch information
rtobar committed Aug 11, 2024
1 parent 60256ef commit a746035
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ of the standard library:
crc32c_hash.update(b' world')
print(crc32c_hash.digest())
# b'\xc9\x94e\xaa'
digest_as_int = int.from_bytes(crc32c_hash.digest(), "big")
print(digest_as_int == crc32c.crc32c(b'hello world'))
# True
For more details see
the documentation on `hash objects <https://docs.python.org/3/library/hashlib.html#hash-objects>`_.
Expand Down

0 comments on commit a746035

Please sign in to comment.