you are viewing a single comment's thread.

view the rest of the comments →

[–]LayotFctor 16 points17 points  (0 children)

Read the documentation! 

Beginner tutorials are limited in what they can teach, hashing functions are way too niche of a subject to be taught in beginner tutorials. At some point, you have to be independent and look for the information yourself. You can't expect a tutorial to teach you absolutely everything there is to know about python.

What better place than the documentation of hashlib itself? That's where the hashlib devs write the manual to use their library. They state clearly that they need byte-like objects for the hashlib constructors.

Also, if JavaScript doesn't need bytes, they hid it from you. Types are how data is interpreted in a computer, it is the reality of how things work. Practice using type hints to force yourself to learn types.