Skip to main content

Verify with VRFY: Ensure the integrity of your file copies, hash by hash!

When beginning to explore cloud storage (or other methods of remotely storing files), one may become concerned about file integrity at some point. When dealing with a large number of individual files, how can one be certain that no file becomes corrupted during the storage process, and that downloaded files remain identical to their uploaded versions? This concern is particularly relevant after undergoing multiple segmentation and encryption/decryption processes. It's impractical to manually verify all files, making file corruption a common worry, especially for those using smaller cloud providers.

Those concerns are mitigated by using a small console application called vrfy. vrfy handles the heavy lifting and verifies the integrity of your backups for you! With a single, easy command, you can:

  1. Verify that copies are identical (i.e., all files are included in both locations, and -by using sha256 hash checksums- that not even a single bit was changed).
  2. Create and store a file with sha256 hash checksums beside your data. This file can be backed up with your data and used for verification later.
  3. Verify that your data is unchanged using the checksum file.

Installation

PIP:

Install vrfy using pip:

pip install vrfy --user

Usage the CLI

1. Verifing that two directories are identical

Verifing that the contents of '/path/of/backup' are identical to those of '/path/of/master'. For example, '/path/of/master' might be a local backup, whereas '/path/of/backup' might be loaded from cloud storage.

vrfy -m /path/of/master -b /path/of/backup -r

or (mismatched checksums are printed to console)

vrfy -m /path/of/master -b /path/of/backup -r -p

2. Storing checksums for future verification

Creating a file that lists checksums for all files within a directory:

vrfy -c /path/of/data

Using -r (recursive) all in sub-directories as well:

vrfy -r -c /path/of/data

3. Verifing files against stored checksums

Verifying that all files within a directory haven't been changed (i.e., their checksums still match):

vrfy -v /path/of/data

Using option -r (recursive) all sub-directories are verified as well:

vrfy -r -v /path/of/data

Using option -p (print) all mismatched checksums are printed to console for further inspection:

vrfy -p -r -v /path/of/data

Verifying the current working directory and all its sub-directories:

vrfy

Verifying file against an expected checksum:

vrfy -f /path/of/file/filename -cs expectedChecksum

Where "expectedChecksum" can be one of the following:

  • A string containing the expected sha256 hash digest.
  • A *.sha256sum-file that includes the expected hash digest.
  • A sums.csv-file created by vrfy that includes the expected hash digest.

4. Other CLI options

Display version of vrfy:

vrfy --version

Display checksum for given file:

vrfy -p -f /path/of/file/filename

Display help:

vrfy -h

Using the python package

Getting started

from vrfy.vrfy import vrfy
vf = vrfy()

# Get version string
versionStr = vf.GetVersion()

# Verify a single file to an expected checksum
Result = vf.VerifyFile("/path/and/fileName.xyz", "expectedChecksum")

# Verify contents of a directory to stored checksums
Result = VerifyFilesAgainstChecksums("path/to/directory")

# Create/store checksum file for later file verification
Result = WriteChecksumFile("path/to/directory")

# Verify that files within master and backup directories are identical
Result = VerifyFiles("path/to/directory/master", "path/to/directory/backup")

where

class Result:
    self.Result: bool            # Determines whether operation was successful (True) or not (False).
    self.Path: str               # Path the result object corresponds to. 
    self.PathError: bool         # True: Path is a valid directory, False otherwise.
    self.MissingFiles: list      # Missing files in (backup) directory that are included in master directory / checksum list.
    self.AdditionalFiles: list   # Additional files in (backup) directory that are NOT included in master directory / checksum list.
    self.ChecksumMismatch: list  # List of files with mismachting checksums.
    self.MasterChecksums: dict   # Dictionary of files within master directory and their checksums.
    self.BackupChecksums: dict   # Dictionary of files within backup directory and their checksums.

Metadata

Release files for vrfy 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vrfy 0.4.0
File Size Uploaded Provenance Actions
vrfy-0.4.0.tar.gz 23.3 kB Without provenance Details for vrfy-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vrfy 0.4.0
File Interpreter ABI Platform Actions
vrfy-0.4.0-py3-none-any.whl Python 3 none any Details for vrfy-0.4.0-py3-none-any.whl

Total release size: 45.8 kB

Release files / vrfy-0.4.0.tar.gz

Download URL vrfy-0.4.0.tar.gz
Size 23.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d0d69bec324469cffc0a994c61c1825231f3e2e86975536b7b71168ee6b5a10f
BLAKE2b-256 checksum
How to use checksums
4791627db52db0406c32fa0cd4bdd72c9ef4cda7444063c400e27101dcbfb5f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19

Release files / vrfy-0.4.0-py3-none-any.whl

Download URL vrfy-0.4.0-py3-none-any.whl
Size 22.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5498fbcb2c66b9297822477ee69e4e891000d729a7efb11145e02039c2fcfebd
BLAKE2b-256 checksum
How to use checksums
510979e16dea297356a548a1c1c2353540c924786e3e54f94a23a70d7525936a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19

Security for vrfy 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page