# Shasums in SHA

**URL:** https://discourse.julialang.org/t/shasums-in-sha/126310
**Category:** General Usage
**Created:** [February 25, 2025, 8:20pm UTC](https://discourse.julialang.org/t/shasums-in-sha/126310 "2025-02-25T20:20:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![dimsinel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dimsinel/32/211083_2.png) [@dimsinel](https://discourse.julialang.org/u/dimsinel)
#### Post date: [February 25, 2025, 8:20pm UTC](https://discourse.julialang.org/t/shasums-in-sha/126310/1 "2025-02-25T20:20:58Z")

</div>

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
julia> sha2 = bytes2hex(SHA.sha2_256("test.tar.gz"))
"75da305f1ed330e119787ca88c76fb2c51148b86efa6f9a9b86ca98128282919"

```

while

```julia
$ 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…

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

```

---

<div class="post-metadata">

### Author: ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)
#### Post date: [February 25, 2025, 9:05pm UTC](https://discourse.julialang.org/t/shasums-in-sha/126310/2 "2025-02-25T21:05:56Z")

</div>

> [@dimsinel](#):
>
> ```julia
> sha = open("test.tar.gz") do f
> sha2_256(f)
> end |> bytes2hex
> 
> ```

FYI you can shorten this to

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

```
