* gcc.dg/guality/guality.exp: Skip on AIX.
[official-gcc.git] / libgo / go / hash / hash.go
blobaa895cf98470ce10939a84b6ae95b530c03143a8
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 provides interfaces for hash functions.
6 package hash
8 import "io"
10 // Hash is the common interface implemented by all hash functions.
11 type Hash interface {
12 // Write adds more data to the running hash.
13 // It never returns an error.
14 io.Writer
16 // Sum appends the current hash to b and returns the resulting slice.
17 // It does not change the underlying hash state.
18 Sum(b []byte) []byte
20 // Reset resets the hash to one with zero bytes written.
21 Reset()
23 // Size returns the number of bytes Sum will return.
24 Size() int
26 // BlockSize returns the hash's underlying block size.
27 // The Write method must be able to accept any amount
28 // of data, but it may operate more efficiently if all writes
29 // are a multiple of the block size.
30 BlockSize() int
33 // Hash32 is the common interface implemented by all 32-bit hash functions.
34 type Hash32 interface {
35 Hash
36 Sum32() uint32
39 // Hash64 is the common interface implemented by all 64-bit hash functions.
40 type Hash64 interface {
41 Hash
42 Sum64() uint64