Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / libgo / go / hash / hash.go
blob56ac259db13a9be5df00fa66f033950d05ac87f0
1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package hash
7 import "io"
9 // Hash is the common interface implemented by all hash functions.
10 type Hash interface {
11 // Write adds more data to the running hash.
12 // It never returns an error.
13 io.Writer
15 // Sum returns the current hash, without changing the
16 // underlying hash state.
17 Sum() []byte
19 // Reset resets the hash to one with zero bytes written.
20 Reset()
22 // Size returns the number of bytes Sum will return.
23 Size() int
26 // Hash32 is the common interface implemented by all 32-bit hash functions.
27 type Hash32 interface {
28 Hash
29 Sum32() uint32
32 // Hash64 is the common interface implemented by all 64-bit hash functions.
33 type Hash64 interface {
34 Hash
35 Sum64() uint64