SHA256 Encryption

What is SHA256?

SHA256 is a cryptographic hash function in the SHA2 family. It takes an arbitrary amount of data and maps it to 512 bits.

It’s often used to validate the integrity of large or important data intended to be transfered over a network. For example, Linux and BSD ISO
download pages often include a SHA checksum which you can use to verify that downloaded the complete file without any corruption. If the SHA’d value of your downloaded file is the same as the provided checksum, you can be sure it matches the file on the server.

How do I check the SHA256 sum of a file?

On OSX: OSX includes a program called shasum that can be used to compute the SHA256 (and SHA 1, 224, 384, and 512) hash of a file.

By default shasum uses SHA1, but it can be used for SHA256 like so:

shasum -a 256 example.txt

On Linux: Linux includes a suite of tools for calculating SHA checksums named after the hashes they computer. They are sha1sum, sha224sum, sha256sum, sha384sum, and sha512sum. The shasum program mentioned above for OSX is also available on Linux.

To calculate the SHA256 hash of a file named “example.txt”, run:

sha256sum example.txt