Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish sha256 hashes for improved user safety #9

Open
rsokl opened this issue Apr 7, 2022 · 0 comments
Open

Publish sha256 hashes for improved user safety #9

rsokl opened this issue Apr 7, 2022 · 0 comments

Comments

@rsokl
Copy link

rsokl commented Apr 7, 2022

Hello! Could you compute and publish the sha256 hashes for your ani-1_dataset.tar.gz file and include them in your README? This will help users to ensure that the data that they download has not been manipulated by some third party.

You can easily compute a hash using:

from hashlib import sha256


def hash_check(fname, hash_fn=sha256):
    """Reads in data from disk and returns hash

    Parameters
    ----------
    fname : str | Path

    hash_fn : Callable[[], Hash], optional (default=hashlib.sha256)

    Examples
    --------
    Checking sha256 hash..

    >>> from hashlib import sha256
    >>> hash_check('./text.txt, sha256)
    'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'
    """
    hash_fn = hash_fn()
    with open(fname, "rb") as f:
        for chunk in iter(lambda: f.read(4096), b""):
            hash_fn.update(chunk)
    return hash_fn.hexdigest()

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant