From Dev.to
How to hash with SHA-256 in Python (and when not to)
hashlib.sha256("hello world") raises a TypeError. That's the first of three places where the famous one-line SHA-256 recipe needs one more line: strings need encoding, files need chunks, and passwords...
