> [!tldr] A trick to see if the data you're looking at is (probably) right.
A checksum is a small additional piece of info you can use to see if some large piece of data is accurate (i.e. it hasn't become corrupt in transmission, or it wasn't tampered with).
Checksums are related heavily to [[Hash Table#Hashing Function|Hashing Functions]] in the [[Public Key Encryption|Cryptography]] world.
## Normal Person Example
> Melissa: "Pick up 6 apples, 3 bananas, and 3 grapefruits"
> Aaron: "One dozen fruits, got it"
## Generating Hashes/Checksums
Turns out this is crazy easy.
```shell
echo "text" | shasum -a 256
```
Or
```shell
shasum -a 256 filename.zip
```
[[Shortcuts App|Siri Shortcuts]] has a build in "Generate Hash" function.
### From Google AI
- **Generate File Hash:**
`shasum -a 256 /path/to/file`
- **Generate Hash for Multiple Files:**
`shasum -a 256 file1.txt file2.txt`
- **Hash a String of Text:**
`echo "Hello World" | shasum -a 256`
- **Save Hash to a File:**
`shasum -a 256 file.zip > file.zip.sha256`
- **Verify File via Saved Hash:**
`shasum -a 256 -c file.zip.sha256`
- **Verify and Only Show Failures:**
`shasum -a 256 -c file.zip.sha256 --quiet`
****
# More
## Source
- college from a long time ago
- XKCD Volume 0 (which technically makes this [[Relevant XKCD]]!)
- Google AI