Python·100 questionsHow to compute file hash (sha256)?SaveUpdated: 2026-08-31Answer•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.Ask AI to clarifyWas this answer helpful?HelpfulNot helpfulSuggest an improvement