Shasums in SHA

Hello everyone.

I am trying to get the shasums of a tarball through SHA< but I just don
t seem to do it right, SHA.sha256 and linux shasum give diferent results. Am I using the wrong function?

Here’s what I do:

julia> sha2 = bytes2hex(SHA.sha2_256("test.tar.gz"))
"75da305f1ed330e119787ca88c76fb2c51148b86efa6f9a9b86ca98128282919"

while

$ shasum -a 256 test.tar.gz 
b1657ba0fcb8fe4a54ad717a13bd54865b0189a1ecb8f116ca70245fe2186b14  test.tar.gz

Obviously different results.

Thanks,
Dimsinel

Edit (Duh).
I was getting the shasum of the string “test.tar.gz”, not the file…

sha = open("test.tar.gz") do f
              sha2_256(f)
       end |> bytes2hex

FYI you can shorten this to

sha = open(sha2_256, "test.tar.gz") |> bytes2hex