Python·100 questions

How to compute file hash (sha256)?

Answer
import hashlib.
h = hashlib.sha256().
Read the file in chunks and h.update(chunk).
At the end, h.hexdigest().
Do not read a huge file entirely.
Was this answer helpful?

More questions in this topic

Related questions from other topics