]> Cypherpunks repositories - gostls13.git/commitdiff
hash/*: document the byte order used by the Sum methods
authorShenghou Ma <minux@golang.org>
Thu, 3 Sep 2015 23:15:26 +0000 (19:15 -0400)
committerMinux Ma <minux@golang.org>
Thu, 10 Sep 2015 03:34:23 +0000 (03:34 +0000)
Fixes #12350.

Change-Id: I3dcb0e2190c11f83f15fb07cc637fead54f734f7
Reviewed-on: https://go-review.googlesource.com/14275
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/hash/adler32/adler32.go
src/hash/crc32/crc32.go
src/hash/crc64/crc64.go
src/hash/fnv/fnv.go

index 7c80796bf9fdca2e1c1e778237b06280ec0ce385..0c733f751af5742d72977be67ca6960762c00fb3 100644 (file)
@@ -33,6 +33,7 @@ type digest uint32
 func (d *digest) Reset() { *d = 1 }
 
 // New returns a new hash.Hash32 computing the Adler-32 checksum.
+// Its Sum method will lay the value out in big-endian byte order.
 func New() hash.Hash32 {
        d := new(digest)
        d.Reset()
index 228cc0461ca1e2cae39bb325f1aa5c8259d19ee5..1b5e0dbde02bceb2df37d70e629210af0df3ea94 100644 (file)
@@ -113,10 +113,12 @@ type digest struct {
 
 // New creates a new hash.Hash32 computing the CRC-32 checksum
 // using the polynomial represented by the Table.
+// Its Sum method will lay the value out in big-endian byte order.
 func New(tab *Table) hash.Hash32 { return &digest{0, tab} }
 
 // NewIEEE creates a new hash.Hash32 computing the CRC-32 checksum
 // using the IEEE polynomial.
+// Its Sum method will lay the value out in big-endian byte order.
 func NewIEEE() hash.Hash32 { return New(IEEETable) }
 
 func (d *digest) Size() int { return Size }
index b420a2256223e01c75bbc74e0778c73b037227c9..54cc56055e48faac50a62f3637a12dcac65cec01 100644 (file)
@@ -50,6 +50,7 @@ type digest struct {
 
 // New creates a new hash.Hash64 computing the CRC-64 checksum
 // using the polynomial represented by the Table.
+// Its Sum method will lay the value out in big-endian byte order.
 func New(tab *Table) hash.Hash64 { return &digest{0, tab} }
 
 func (d *digest) Size() int { return Size }
index 09c5b2a3361841c0802c9e7ae5b5a9da9338018a..f1fbb25bdf5899a32fc61a24406f4860ed1075ac 100644 (file)
@@ -27,24 +27,28 @@ const (
 )
 
 // New32 returns a new 32-bit FNV-1 hash.Hash.
+// Its Sum method will lay the value out in big-endian byte order.
 func New32() hash.Hash32 {
        var s sum32 = offset32
        return &s
 }
 
 // New32a returns a new 32-bit FNV-1a hash.Hash.
+// Its Sum method will lay the value out in big-endian byte order.
 func New32a() hash.Hash32 {
        var s sum32a = offset32
        return &s
 }
 
 // New64 returns a new 64-bit FNV-1 hash.Hash.
+// Its Sum method will lay the value out in big-endian byte order.
 func New64() hash.Hash64 {
        var s sum64 = offset64
        return &s
 }
 
 // New64a returns a new 64-bit FNV-1a hash.Hash.
+// Its Sum method will lay the value out in big-endian byte order.
 func New64a() hash.Hash64 {
        var s sum64a = offset64
        return &s