A simple command line checksum generator and checker written in Go, compatible with shasum, sha1sum, sha224sum, sha256sum and sha512sum. Builds easily on Mac, Linux and Windows.
Find a file
2023-11-11 18:02:38 -06:00
.github/workflows Add workflow 2020-07-29 17:41:07 -05:00
testdata More test coverage, clean some lint 2020-08-03 18:04:14 -05:00
.gitignore Move to codeberg 2023-11-11 18:02:38 -06:00
.goreleaser.yml More test coverage, clean some lint 2020-08-03 18:04:14 -05:00
go.mod Move to codeberg 2023-11-11 18:02:38 -06:00
LICENSE Initial import 2019-01-30 15:54:47 -06:00
main.go More test coverage, clean some lint 2020-08-03 18:04:14 -05:00
main_test.go More test coverage, clean some lint 2020-08-03 18:04:14 -05:00
README.md Move to codeberg 2023-11-11 18:02:38 -06:00

gohash

A command line checksum generator and checker written in Go. Why? Mostly because Windows lacks the standard Unix tools.

Description

This is a simple command line checksum program. It will hash the files or directories given as arguments, including recursively descending any directories so you don't need to use find.

It supports the following algorithms:

  • crc32 (IEEE CRC-32)
  • md5 (RFC 1321)
  • sha1 (SHA-1)
  • sha224 (SHA-2-224)
  • sha256 (SHA-2-256)
  • sha384 (SHA-2-384)
  • sha512 (SHA-2-512)
  • sha512224 (SHA-2-512/224)
  • sha512256 (SHA-2-512/256)

Its checksum files should be compatible with the shasum, sha1sum, sha224sum, sha256sum and sha512sum Linux commands, and the shasum program supplied with macOS.

The CRC32 function is compatible with that of 7-zip and the Linux crc32 program, but the output format is different. The GNU cksum program uses a different algorithm.

Install

The code uses only Go standard library functions and can easily be compiled for Windows, or any other OS and architecture supported by Go, including:

  • Android
  • macOS
  • *BSD
  • Linux (PowerPC, ARM or MIPS)
  • Windows (386 or AMD64)

For example, to build a Windows binary using a Mac or Linux machine:

 env GOOS=windows GOARCH=amd64 go build -v

To build for the system you're using, a simple go build should suffice.

Or to install:

go install codeberg.org/meta/gohash@latest

Limitations

The "universal line endings" mode of shasum is not supported (†). This utility always compares file contents in binary mode. However, checksum files can have Unix or MS-DOS line endings.

† Yet. Patches welcome!