HACKER Q&A
📣 valenterry

Why is Google's sha checksum not matching?


Trying to download https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-darwin-arm.tar.gz from https://cloud.google.com/sdk/docs/install-sdk#installing_the_latest_version and using shasum (on mac) does not give the specified "48b64a1b9003e801cbaedb3d1a7f0d8989c1af207858ea32beea8095b26bd1e9" but a different one.

A colleague confirmed. What's going on?


  👤 mubou Accepted Answer ✓
Are you using `shasum -a 256`? It defaults to SHA-1 otherwise.

I get the correct hash on linux using sha256sum.

Edit: You may need to pass -b (--binary). The man page[0] says it defaults to "text mode," whatever that means (this SO question[1] for md5sum suggests it has to do with how it opens the file, which apparently makes no difference on Linux/Windows but maybe it does on Mac?)

[0]: https://ss64.com/mac/shasum.html [1]: https://unix.stackexchange.com/q/127959