GMS High-level Cryptographic Hash Wrappers for Go
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-09 10:54:58 +01:00
.github init: add additional std files 2026-09-10 04:30:08 +01:00
docs feat: bulk of library additions 2026-09-10 04:31:46 +01:00
tests feat: added variant of xxh3 that doesn't use the rng for setting seed 2026-10-09 10:54:58 +01:00
.gitattributes init: add additional std files 2026-09-10 04:30:08 +01:00
.gitignore init: initial commit 2026-09-10 04:28:56 +01:00
.markdownlint-cli2.jsonc init: add additional std files 2026-09-10 04:30:08 +01:00
CHANGELOG.md feat: bulk of library additions 2026-09-10 04:31:46 +01:00
COPYING.md init: initial commit 2026-09-10 04:28:56 +01:00
examples_test.go feat: bulk of library additions 2026-09-10 04:31:46 +01:00
extensible.go feat: include xxh3 64 bit and 128 bit versions, added WriteString interface and mod upgrades 2026-09-10 05:46:04 +01:00
fixed.go feat: added variant of xxh3 that doesn't use the rng for setting seed 2026-10-09 10:54:58 +01:00
go.mod feat: include xxh3 64 bit and 128 bit versions, added WriteString interface and mod upgrades 2026-09-10 05:46:04 +01:00
go.sum chore: go mod tidy 2026-09-10 05:51:05 +01:00
hash.go feat: added variant of xxh3 that doesn't use the rng for setting seed 2026-10-09 10:54:58 +01:00
LICENSE init: initial commit 2026-09-10 04:28:56 +01:00
README.md feat: bulk of library additions 2026-09-10 04:31:46 +01:00
SECURITY.md init: initial commit 2026-09-10 04:28:56 +01:00

Hash - High-level Cryptographic Hash Wrappers for Go

This package provides High-level Go wrappers for standard hash functions, unifying a set of common cryptographic hash operations behind a single API, allowing callers to switch between algorithms with minimal code changes while relying on well-maintained and secure backends. It unifies Merkle-Damgård and extendable-output functions behind a single API, providing HMAC and HKDF helpers along with consistent metadata (block sizes, security strength, availability). Hashers are immutable handles that produce fresh state, preventing cross-call contamination and enforcing sane defaults for sizes.

HMAC key sizes longer than the hash function's block size create a panic. Standard HMAC hashes longer keys, but that reduces the effective security level advertised by the original key size. We encourage using appropriate key lengths.

Import

import "rtlabs.tech/gms-hash"

Quick Start

  • Quickly hash data:
message := []byte("message")

output := hash.SHA256.Hash(message)
  • HMAC
message := []byte("message")
key := []byte("key")

hmac := hash.SHA256.GetHashFunction().Hmac(message, key)
  • If you have an identifier from the crypto package, it's easy:
id := crypto.SHA256
message := []byte("message")

output := hash.FromCrypto(id).Hash(message)

See examples_test.go for additional HMAC, HKDF extract/expand, and metadata usage patterns.

Versioning

SemVer is used for versioning. For the versions available, see the tags on the repository.

Code and Documentation Copyright © 1994-2026, Stephen Kapp and Reaper Technologies Limited. All Rights Reserved.