How can I find the SHA256 hash of a webpage using Linux tools (CURL, etc.)?
Yeah, you can use
sha256sum in a single command, like so:
curl www.google.com | sha256sum
Which will give:
┌─[✗]─[16:51:49]─[kazwolfe@BlackHawk] └──> lib $ curl www.google.com | sha256sum % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 10221 0 10221 0 0 15500 0 --:--:-- --:--:-- --:--:-- 15509 803d9c7538817dd8b44f0f2b3990ced288413a1b5a6d042d4216170b065e432b -
Your SHA256 sum will be present down below, as the long string of hex code gibberish stuff below the
curl status output.
This works because cURL will push the website's content to something known as STDOUT, which typically gets shown to the terminal. However, when you use the pipe symbol (
|), you redirect STDOUT of one program to the STDIN of another. Therefore,
sha256sum is reading STDIN from the cURL command, which is then being used to actually compute the SHA256 value.