Skip to content

manuelbamise/comparing_hashing_algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Comparing Hashing Algorithms for Secure Computation

A comparative benchmarking and security analysis framework for six 256-bit hash algorithms: SHA-256, SHA-3-256, BLAKE2b-256, BLAKE3, Gimli-Hash, and SPARKLE Esch256.

Tags: cryptography, hash-functions, benchmarking, security-analysis, avalanche-effect, blake3, blake2b, sha256, sha3, gimli, sparkle, lightweight-cryptography

Libraries Used

Algorithm Library
SHA-256 crypto/sha256 (stdlib)
SHA-3-256 golang.org/x/crypto/sha3
BLAKE2b-256 golang.org/x/crypto/blake2b
BLAKE3 github.com/zeebo/blake3
Gimli-Hash github.com/bmkessler/gimli
SPARKLE Esch256 Pure Go port (no external dependency)

Commands Reference

Prerequisites

go version              # requires Go 1.25.3+
go env GOPATH           # verify module cache

Run All Benchmarks (9 sizes × 6 algorithms = 54 benchmarks)

go test -bench=. -benchmem ./benchmarks/ | tee results/benchmark_results.txt

Run Benchmarks for a Single Algorithm

go test -bench=BenchmarkSHA256 -benchmem ./benchmarks/
go test -bench=BenchmarkSHA3 -benchmem ./benchmarks/
go test -bench=BenchmarkBLAKE2b -benchmem ./benchmarks/
go test -bench=BenchmarkBLAKE3 -benchmem ./benchmarks/
go test -bench=BenchmarkGimli -benchmem ./benchmarks/
go test -bench=BenchmarkSPARKLE -benchmem ./benchmarks/

Run KAT (Known-Answer Tests)

go test -v -run TestKAT ./benchmarks/

Run Security Property Tests

Avalanche Effect (~9 s):

go test -v -run TestAvalancheEffect ./benchmarks/ -timeout 300s

Output Distribution Uniformity (~6 s):

go test -v -run TestOutputDistribution ./benchmarks/ -timeout 600s

Both security tests together (~15 s):

go test -v -run "TestAvalancheEffect|TestOutputDistribution" ./benchmarks/ -timeout 600s | tee results/security_results.txt

Run All Tests (KAT + Security)

go test -v ./benchmarks/ -timeout 600s

Quick Correctness Check

go run .

Full Reproducibility Suite

go vet ./... &&
  go run . &&
  go test -v -run TestKAT ./benchmarks/ &&
  go test -bench=. -benchmem ./benchmarks/ | tee results/benchmark_results.txt &&
  go test -v -run "TestAvalancheEffect|TestOutputDistribution" ./benchmarks/ -timeout 600s | tee results/security_results.txt

About

A comparative benchmarking and security analysis framework for six 256-bit hash algorithms: SHA-256, SHA-3-256, BLAKE2b-256, BLAKE3, Gimli-Hash, and SPARKLE Esch256.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Contributors

Languages