How to verify file integrity?

To verify file integrity, you can use checksums or hash functions. Here’s a simple way to do it using md5sum or sha256sum in a Unix-like environment:

  1. Generate a checksum for the original file:

    md5sum filename.txt > filename.txt.md5

    or for SHA256:

    sha256sum filename.txt > filename.txt.sha256
  2. Verify the file later:
    To check the integrity, you can use:

    md5sum -c filename.txt.md5

    or for SHA256:

    sha256sum -c filename.txt.sha256

If the output indicates that the file is OK, then the integrity is verified. If not, the file may have been altered or corrupted.

0 Comments

no data
Be the first to share your comment!