How can I find the SHA256 hash of a webpage using Linux tools (CURL, etc.)?

  • This is offtopic here at AskUbuntu. I would consult the cryptography stackexchange.
    – negusp
    Commented Oct 26, 2016 at 23:52
  • @PatrickNegus My bad, I should've posted this elsewhere. I came here out of habit... Commented Oct 27, 2016 at 0:10
  • That's fine. At least you got your answer :)
    – negusp
    Commented Oct 27, 2016 at 0:11
  • 1
    @PatrickNegus: Why? Downloading web resources and calculating checksums are both common things to do on a Linux/Ubuntu system and on topic here. Commented Oct 27, 2016 at 10:24

1 Answer 1


Yeah, you can use curl and sha256sum in a single command, like so:

curl www.google.com | sha256sum

Which will give:

└──> 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .