diff options
Diffstat (limited to 'libgo/go/hash/crc64/crc64.go')
-rw-r--r-- | libgo/go/hash/crc64/crc64.go | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/libgo/go/hash/crc64/crc64.go b/libgo/go/hash/crc64/crc64.go index 42e53c3a5bd..e5c1db4b3d2 100644 --- a/libgo/go/hash/crc64/crc64.go +++ b/libgo/go/hash/crc64/crc64.go @@ -75,18 +75,17 @@ func (d *digest) Write(p []byte) (n int, err error) { func (d *digest) Sum64() uint64 { return d.crc } -func (d *digest) Sum() []byte { - p := make([]byte, 8) +func (d *digest) Sum(in []byte) []byte { s := d.Sum64() - p[0] = byte(s >> 56) - p[1] = byte(s >> 48) - p[2] = byte(s >> 40) - p[3] = byte(s >> 32) - p[4] = byte(s >> 24) - p[5] = byte(s >> 16) - p[6] = byte(s >> 8) - p[7] = byte(s) - return p + in = append(in, byte(s>>56)) + in = append(in, byte(s>>48)) + in = append(in, byte(s>>40)) + in = append(in, byte(s>>32)) + in = append(in, byte(s>>24)) + in = append(in, byte(s>>16)) + in = append(in, byte(s>>8)) + in = append(in, byte(s)) + return in } // Checksum returns the CRC-64 checksum of data |