Golang hash/crc32.Checksum function and Table type example

package hash/crc32

Checksum returns the CRC-32 checksum of data using the polynomial represented by the Table.

Golang hash/crc32.Checksum function and Table usage example

 package main

 import (
 "fmt"
 "hash/crc32"
 )

 var crcTable *crc32.Table

 func main() {

 checksum := crc32.Checksum([]byte("abcd"), crcTable)

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

 }

Output :

Checksum : 92c80a31

References :

http://golang.org/pkg/hash/crc32/#Table

http://golang.org/pkg/hash/crc32/#Checksum

Advertisement