Objective
A hash function turns any data into a fixed-size fingerprint. The same text always gives the same fingerprint, and changing a single character changes it completely. The hashlib module offers many algorithms.
Instructions
- The first line has the number
nof lines; each one isalgorithm text, wherealgorithmismd5,sha1,sha256orsha512and the text is the rest of the line. - Show the fingerprint in hexadecimal (
hexdigest()) of the text encoded in UTF-8. Usehashlib.new.
2
md5 hola
sha256 hola mundo
4d186321c1a7f0f354b297e8914ab240
0b894166d3336435c800bea36ff21b29eaa801a52f584c006c49289a0dcf6e2f
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise