Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ CheckSumFolder -dir /path/to/dir [-list hashes.txt] [-hash sha256]
If `-list` is omitted the results are printed to the console. When a file is
specified and it already contains results, existing entries are skipped so the
operation can be resumed. Use `-hash` to select the hashing algorithm. Allowed
values are `sha1`, `sha256`, `blake2b`, `blake3`, `xxhash`, `xxh3`, `xxh128`, `t1ha1`, `t1ha2`, `highway64`, `highway128`, `highway256`, `wyhash` and `rapidhash`.
values are `md5`, `sha1`, `sha256`, `blake2b`, `blake3`, `xxhash`, `xxh3`, `xxh128`, `t1ha1`, `t1ha2`, `highway64`, `highway128`, `highway256`, `wyhash` and `rapidhash`.
When using a HighwayHash variant you can provide a custom key via the `-hkey`
flag. The key must be 32 bytes encoded as hex or base64. If omitted the
default key `AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8=` (base64) is used.
Expand Down
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"bufio"
"crypto/md5"
"crypto/sha1"
stdsha256 "crypto/sha256"
"encoding/base64"
Expand Down Expand Up @@ -52,7 +53,7 @@ func main() {
progress := flag.Bool("progress", false, "show progress updates")
jsonl := flag.Bool("json", false, "output in JSONL format")
hkeyFlag := flag.String("hkey", defaultHighwayKey, "hex or base64 HighwayHash key")
algo := flag.String("hash", "sha1", "hash algorithm: sha1|sha256|blake2b|blake3|xxhash|xxh3|xxh128|t1ha1|t1ha2|highway64|highway128|highway256|wyhash|rapidhash")
algo := flag.String("hash", "sha1", "hash algorithm: md5|sha1|sha256|blake2b|blake3|xxhash|xxh3|xxh128|t1ha1|t1ha2|highway64|highway128|highway256|wyhash|rapidhash")
flag.Parse()

if k, err := hex.DecodeString(*hkeyFlag); err == nil {
Expand Down Expand Up @@ -427,6 +428,8 @@ func hashFile(path, algo string) (string, error) {

var h hash.Hash
switch alg {
case "md5":
h = md5.New()
case "sha1":
h = sha1.New()
case "sha256":
Expand Down