A Hash computes a seeded hash of a byte sequence.
The zero Hash is a valid Hash ready to use.
A zero Hash chooses a random seed for itself during
the first call to a Reset, Write, Seed, Sum64, or Seed method.
For control over the seed, use SetSeed.
The computed hash values depend only on the initial seed and
the sequence of bytes provided to the Hash object, not on the way
in which the bytes are provided. For example, the three sequences
h.WriteByte('f'); h.WriteByte('o'); h.WriteByte('o')
all have the same effect.
Hashes are intended to be collision-resistant, even for situations
where an adversary controls the byte sequences being hashed.
A Hash is not safe for concurrent use by multiple goroutines, but a Seed is.
If multiple goroutines must compute the same seeded hash,
each can declare its own Hash and call SetSeed with a common Seed.
(*T) BlockSize() int
(*T) Seed() Seed
(*T) SetSeed(seed Seed)
(*T) Size() int
(*T) Sum(b byte) byte
(*T) Sum64() uint64
(*T) Write(b byte) (int, error)
(*T) WriteByte(b byte) error
(*T) WriteString(s string) (int, error)
*T : hash.Hash
*T : hash.Hash64
*T : io.ByteWriter
*T : io.StringWriter
*T : io.Writer
A Seed is a random value that selects the specific hash function
computed by a Hash. If two Hashes use the same Seeds, they
will compute the same hash values for any given input.
If two Hashes use different Seeds, they are very likely to compute
distinct hash values for any given input.
A Seed must be initialized by calling MakeSeed.
The zero seed is uninitialized and not valid for use with Hash's SetSeed method.
Each Seed value is local to a single process and cannot be serialized
or otherwise recreated in a different process.
func MakeSeed() Seed
func (*Hash).Seed() Seed
func (*Hash).SetSeed(seed Seed)
The pages are generated with Goldsv0.1.6-preview. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project and developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.