mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-04-20 16:44:44 +00:00
20 lines
606 B
Go
20 lines
606 B
Go
// Package keccak provides Keccak-256 hashing with platform-specific acceleration.
|
|
package keccak
|
|
|
|
import "hash"
|
|
|
|
// KeccakState wraps the keccak hasher. In addition to the usual hash methods, it also supports
|
|
// Read to get a variable amount of data from the hash state. Read is faster than Sum
|
|
// because it doesn't copy the internal state, but also modifies the internal state.
|
|
type KeccakState interface {
|
|
hash.Hash
|
|
Read([]byte) (int, error)
|
|
}
|
|
|
|
const rate = 136 // sponge rate for Keccak-256: (1600 - 2*256) / 8
|
|
|
|
var _ KeccakState = (*Hasher)(nil)
|
|
|
|
func NewFastKeccak() *Hasher {
|
|
return &Hasher{}
|
|
}
|