Golang hash/crc64.Update function example

package hash/crc64

Update returns the result of adding the bytes in p to the crc.

Golang hash/crc64.Update function usage example

 package main

 import (
 "fmt"
 "hash/crc64"
 )

 var ECMATable = crc64.MakeTable(crc64.ECMA)

 func main() {

 csum := crc64.Checksum([]byte("abcd"), ECMATable)

 fmt.Printf("Checksum : %x\n", csum)

 updatedcsum := crc64.Update(csum, ECMATable, []byte("defg"))


 fmt.Printf("Updated checksum : %x\n", updatedcsum)

 }

Output :

Checksum : 3c9d28596e5960ba

Updated checksum : a4741d7d024ef7b4

Reference :

http://golang.org/pkg/hash/crc64/#Update

Advertisement