Objective
Fingerprints are used to detect that data has changed: the fingerprint is published with the data and whoever receives it recomputes and compares it. To compare fingerprints use hmac.compare_digest, which does not reveal through response time where the first difference is.
Instructions
- The first line has the number
nof lines; each one isfingerprint text: the expected SHA-256 fingerprint (in hexadecimal) and the text, which is the rest of the line. - Show
OKif the fingerprint of the text matches (ignoring case in the expected one) orCORRUPTif not.
2
0b894166d3336435c800bea36ff21b29eaa801a52f584c006c49289a0dcf6e2f hola mundo
b221d9dbb083a7f33428d7c2a3c3198ae925614d70210e28716ccaa7cd4ddb79 adios
OK
CORRUPT
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise