SQLite Forum

sha3 (sha3sum)
Login

sha3 (sha3sum)

(1) By anonymous on 2020-11-18 15:56:53 [link]

For me, this download does not match the value returned by my sha3sum utility...
https://sqlite.org/snapshot/sqlite-snapshot-202011121816.tar.gz

Can someone confirm the download matches the checksum, please...

(2) By Stephan Beal (stephan) on 2020-11-18 16:03:06 in reply to 1 [link]

```
[pi@pi4b8:~/Downloads]$ fossil sha3sum sqlite-snapshot-202011121816.tar.gz
816f56ba14c9647882184e6f576a44abcb004a1eb1c8b10bd806dda9a79a6816  sqlite-snapshot-202011121816.tar.gz
```

That matches what is currently at <https://sqlite.org/download.html>:

```
(sha3: 816f56ba14c9647882184e6f576a44abcb004a1eb1c8b10bd806dda9a79a6816)
```

(3) By Warren Young (wyoung) on 2020-11-18 16:22:49 in reply to 1

If that's [this version of `sha3sum`][1], it's documented to do a SHA3-224 by default, whereas the string you're referencing is 64 characters long, thus 64 nibbles × 4 bits = SHA3-256. You'd thus need to pass "`-a 256`" to get a proper comparison.


[1]: https://www.mankier.com/1/sha3sum

(4) By Keith Medcalf (kmedcalf) on 2020-11-18 17:04:36 in reply to 1 [link]

Seems OK to me:

```
>md5 sqlite-snapshot-202011121816.tar.gz 816f56ba14c9647882184e6f576a44abcb004a1eb1c8b10bd806dda9a79a6816
3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]
sys.version_info(major=3, minor=9, micro=0, releaselevel='final', serial=0)
sqlite-snapshot-202011121816.tar.gz
 File Name:  sqlite-snapshot-202011121816.tar.gz
      Size:  2927899
       md4:  EBD2 B988 01E0 EA8C C20C A813 C90A 9C59
       md5:  68E3 9067 96AF 94F3 8C96 A404 75B8 CE48
      sha1:  1C41 8502 2F82 34D2 A7E8 57CF 876D C6B0 A2C3 9825
    sha224:  64C3 4D69 72FC 8F26 3A36 52F6 D233 D89D 1DFE 3D76 8DAD 194C 95C1 77C9
    sha256:  4D9E C6C9 3F24 C228 2EE5 ECE7 AD59 2B58 351C 84D5 65E7 F52F 748C D7A7 E9A6 62F1
    sha384:  04B8 933D B09C 2FE4 2703 758C FA93 0D2A 4A50 CFC7 0F56 FDC2 FD75 4949 4FF0 6D6E
             9B4F D3AA 8676 7EC6 39C2 BE63 494E 670F
    sha512:  4F3B ECEC 6A0C 09B0 951F FE85 17F7 9715 1E24 1C35 AEA7 D84C D318 16B7 1FD1 A325
             54C3 BB22 1A4E 6EC8 4205 000B 8E02 C939 E3A9 FF08 BC3C 93FF 1A5F 3D88 3D80 29CD
  sha3_224:  F501 28BA 99B5 DC4D 7BA0 0E1B 9F11 7B97 48A0 730A 3BA2 C261 EA55 C874
  sha3_256:  816F 56BA 14C9 6478 8218 4E6F 576A 44AB CB00 4A1E B1C8 B10B D806 DDA9 A79A 6816
  sha3_384:  C7E1 9247 07CB 2344 CD75 8CED 9A0E 39FD C6C6 B875 E073 6BD8 C48C 739C 0100 C726
             155F 3646 A448 0E41 CEAD 084A 7552 0B3F
  sha3_512:  68EA 12D0 7F44 32F6 ECE4 F1F3 7AA5 BA60 AF6F 1397 6EC8 7D7B 5BAE EA3B FE60 2BED
             6FC0 E087 277B 95E5 3C12 602B 6111 EE7C F66E 39F0 9BE6 29C7 FB7F 25E8 177F 4B08
   blake2b:  35F2 B763 C562 7A70 EC7D 3A32 0621 B651 2969 23DD AD5B 1C8B 3C58 C5FD C0AE 9EB9
             1068 B080 3DC7 9A75 B492 8873 169F 34F0 7727 A756 F7CB 4A33 5A57 EBB4 231B D158
   blake2s:  D3EA 250B 1FC3 7F6F E73D 6A6E D894 6F1E 8585 66E7 513B E94F 6091 78FE 1AE4 6307
  md5-sha1:  68E3 9067 96AF 94F3 8C96 A404 75B8 CE48 1C41 8502 2F82 34D2 A7E8 57CF 876D C6B0
             A2C3 9825
      mdc2:  7B63 FF54 4EFB 6A70 E44A C555 A1C9 C465
 ripemd160:  AC61 4046 48C0 7C74 2C64 D04E 4216 A2E8 9A66 15B0
sha512_224:  1964 A2A7 420F AA61 05F8 3B69 BCDC B293 7B74 3122 8BAA 5B82 24D1 6EC6
sha512_256:  7EF3 FEEB 57B2 D3AC 6733 4002 1BBF 7C28 35F9 3EDB E346 159B 304C A1ED 29EB 58D5
       sm3:  8BBF BAB8 903A CE5B 4AA6 0608 AF67 9954 ABDA 51AD 1F53 B47E D367 FF58 5358 0C51
 whirlpool:  AAE4 3071 5B9B FAD4 6A3C BDAA 6A86 275B 51C4 DDCA 4A4B 699E 6707 B86F 02E2 D3EB
             A541 404C A804 8C18 AFC1 C395 BFF3 BE3E C7E9 0EDA AF2B 1DC0 7D13 F258 61D5 C72C
sha3_256 OK
```

(5) By Kevin Youren (KevinYouren) on 2020-11-22 23:12:05 in reply to 4 [link]

Keith, I like your detailed display, thanks.

This is the second time this year this query has been asked.

md5sum is a single value, whereas sha3 has a set.

I suggest changing sha3 to sha3-256, at least in the Download page, and perhaps the other pages that appear with Search.

(6) By Keith Medcalf (kmedcalf) on 2020-11-23 00:22:36 in reply to 5 [link]

It is a wee Python3 program that attempts to compute every hash available in the hashlib and prints the results and attempts to "match" additional input parameters against all the hashes telling you what it found.  It is a little slow for large files.  My latest fiddle is here:

```
from sys import argv, exit, version, version_info
import hashlib


def prettyPrintHexString(hexstring, Wrap=False, indent=0):
    retval = ''
    for i in range(0, len(hexstring), 4):
        retval += hexstring[i:i+4] + ' '
        if Wrap:
            if len(retval) - indent > 65:
                retval = retval.strip() + '\n' + ' '*indent
                Wrap = False
    return retval.strip()


print(version)
print(version_info)
hList = []
for i in argv[1:]:
    if i.startswith('--'):
        hList.append(i[2:])
for i in hList:
    argv.remove('--' + i)

try:
    f = open(argv[1], 'rb')
except:
    print("File", argv[1], "could not be opened for reading")
    exit(-1)

if not hList:
    hList = ['md2', 'md4', 'md5',
             'sha', 'sha1',
             'sha224', 'sha256', 'sha384', 'sha512',
             'sha3_224', 'sha3_256', 'sha3_384', 'sha3_512'
            ]
    for algo in sorted(hashlib.algorithms_available):
        if not algo in hList:
            hList.append(algo)

hObj = [ ]
hTxt = [ ]
for hash in hList:
    try:
        hObj.append(hashlib.new(hash))
        hTxt.append(hash)
    except:
        pass

x = 1
size = 0
mb = 1024*1024
rs = 16*mb
bs = chr(8)*79

while x:
    data = f.read(rs)
    x = len(data)
    if x > 0:
        size += x
        for i in range(len(hObj)):
            hObj[i].update(data)
    data = None
    print(bs + 'Read: %5d MBytes' % (size/mb,), end=' ', flush=True)
print(bs, ' '*20, end=' ')

f.close()

print(bs + " File Name: ", argv[1])
print("      Size: ", size)
for i in range(len(hObj)):
    try:
        print("%10s: " % (hTxt[i]), prettyPrintHexString(hObj[i].hexdigest().upper(), Wrap=True, indent=13))
    except:
        pass

test = ''.join(argv[2:]).lower()
if test:
    for i in range(len(hObj)):
        try:
            check = hObj[i].hexdigest().lower()
            if test == check:
                print(hTxt[i], "MATCH")
            elif test in check:
                print(hTxt[i], "PARTIAL @ %d:%d" % (check.find(test), len(test)))
        except:
            pass
```

(7) By Kevin Youren (KevinYouren) on 2020-11-24 00:04:19 in reply to 6 [link]

Thanks, Keith, much appreciated.