On this page
hashlib.shake_128
Prev: hashlib.sha512 | Up: hashlib | Next: hashlib.shake_256
Rel: hashlib.blake2b, hashlib.blake2s, hashlib.file_digest, hashlib.md5
Ref: docs.python.org — hashlib.shake_128
Tags: #public #python3 #stdlib #hashlib
Import
import hashlib
from hashlib import shake_128
Signature & Overview
hashlib.shake_128(data=b'', *, usedforsecurity=True, string=None)
Returns a shake-128 variable hash object; optionally initialized with a string
Usage
import hashlib
h = hashlib.shake_128(b"hello")
assert len(h.hexdigest(16)) == 32
assert len(h.digest(20)) == 20
Gotchas
- Must pass
lengthto.digest(n)/.hexdigest(n): Calling.hexdigest()with no length argument raisesTypeErrorbecause SHAKE is an extendable-output function (XOF).
REPL Inspect
from hashlib import shake_128
help(shake_128)
Linked from
Related notes
- tuts/python3/stdlib_module/hashlib/sha512 Linked here; links to this page; shared tags: #hashlib, #stdlib
- tuts/python3/stdlib_module/hashlib/shake_256 Linked here; links to this page; shared tags: #hashlib, #stdlib
- tuts/python3/stdlib_module/hashlib Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/hashlib/blake2b Linked here; shared tags: #hashlib, #stdlib
- tuts/python3/stdlib_module/hashlib/blake2s Linked here; shared tags: #hashlib, #stdlib
- tuts/python3/stdlib_module/hashlib/file_digest Linked here; shared tags: #hashlib, #stdlib
- tuts/python3/stdlib_module/hashlib/md5 Linked here; shared tags: #hashlib, #stdlib
- tuts/python3/stdlib_module/hashlib/new shared tags: #hashlib, #stdlib
- tuts/python3/stdlib_module/hashlib/pbkdf2_hmac shared tags: #hashlib, #stdlib
- tuts/python3/stdlib_module/hashlib/sha1 shared tags: #hashlib, #stdlib