Skip to main content

judge.sha256

judge.sha256(path)

Hex SHA-256 of a file.

Parameters

Name Type Description Default
path Path The file. required

Returns

Name Type Description
str str The 64-character digest.

Examples

from pathlib import Path
from tempfile import TemporaryDirectory

from spotregen.judge import sha256

with TemporaryDirectory() as tmp:
    path = Path(tmp) / "x.txt"
    path.write_text("abc")
    print(sha256(path)[:16])
ba7816bf8f01cfea