README.md
0.61 Kb · 26 lines
keccak256
Keccak-256 hash (32‑byte output). Port of Go's x/crypto/sha3 (legacy Keccak variant).
Usage
1data := []byte("hello world")
2digest := keccak256.Hash(data) // [32]byte
3
4h := keccak256.NewLegacyKeccak256() // streaming
5h.Write([]byte("hello "))
6h.Write([]byte("world"))
7full := h.Sum(nil) // []byte len 32
API
1func Hash(data []byte) [32]byte
2func NewLegacyKeccak256() hash.Hash
Hash
= one-shot helper. NewLegacyKeccak256
= streaming (implements hash.Hash).
Notes
- Fixed size: 32 bytes (256 bits).
- Uses legacy Keccak padding (differs from finalized SHA3-256 padding).