# Data Integrity

In the previous section, we saw that **hash functions act like digital fingerprints** — fixed-length, unique values that make tampering with data easy to detect. This property is not just theoretical: it has **practical, everyday applications**.

One of the most important uses is **ensuring data integrity** — making sure a file or message you receive is exactly the same as the one that was originally sent, with nothing altered in between.

To illustrate, let’s look at a simple, real-world example of how hash functions help users verify that a downloaded file is **genuine and safe**.

#### Why File Verification Matters

Imagine Bob wants to download the most recent version of Debian Linux. He visits debian.org and downloads an .isofile. Before running it, Bob wants to be sure the file is genuine and hasn’t been tampered with — otherwise he risks installing hidden malware.

#### Using Checksums

On the Debian website, Bob finds a list of **checksums** (also called **hashes** or **message digests**) for the available `.iso` files:

```
c685b85cf9f248633ba3cd2b9f9e781fa03225587e0c332aef2063f6877a1f0622f56d44cf0690087b0ca36883147ecb5593e3da6f965968402cdbdf12f6dd74  debian-11.2.0-amd64-netinst.iso 
f2da0996196f19585b464e48bfb6b8e4938eb596667d92a5ebd428e1a88a1a115c00f1d052f350eca44fa08f42f0500c63351763dfb47f1e1783f917590c175d  debian-edu-11.2.0-amd64-netinst.iso 
9b5b0475fbb3235ebb7da71415f10921b02131b7debc9325403f85f9f6798a3e902d6257831a7ec9c7aef3256817fb76c4f01bb5d035bfcdb3dc24da24fa1bda  debian-mac-11.2.0-amd64-netinst.iso
```

&#x20;These values were generated using the **SHA-512 hash function**.

#### Verifying the Download

Bob now runs the same **SHA-512 hash function** on his downloaded file:

```
openssl sha512 ~/Downloads/debian-11.2.0-amd64-netinst 

//Output: SHA512(debian-11.2.0-amd64-netinst.iso)= c685b85cf9f248633ba3cd2b9f9e781fa03225587e0c332aef2063f6877a1f0622f56d44cf0690087b0ca36883147ecb5593e3da6f965968402cdbdf12f6dd74
```

The result matches one of the published checksums.

#### Key Learning

✅ If the **hash of Bob’s file matches the published hash**, he can be confident the file is **authentic** and **unaltered**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hub.bsvblockchain.org/higher-learning/bsv-academy/bitcoin-primitives-hash-functions/what-are-hash-functions/data-integrity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
