Golang hash/crc64.New and MakeTable functions example

package hash/crc64

New creates a new hash.Hash64 computing the CRC-64 checksum using the polynomial represented by the Table.

Golang hash/crc64.New and MakeTable functions usage example

 package main

 import (
 "fmt"
 "hash/crc64"
 )

 var ECMATable = crc64.MakeTable(crc64.ECMA)

 func main() {
 hasher := crc64.New(ECMATable)
 hasher.Reset()
 hasher.Write([]byte("abcd"))

 fmt.Printf("Hash64 value : %x\n", hasher.Sum64())

 }

Output :

Hash64 value : 3c9d28596e5960ba

Reference :

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

Advertisement