github.com/go-board/x-go@v0.1.2-0.20220610024734-db1323f6cb15/xhash/64.go (about)

     1  package xhash
     2  
     3  import (
     4  	"hash/crc64"
     5  )
     6  
     7  var crc64Table = crc64.MakeTable(crc64.ECMA)
     8  
     9  // Sum64 run crc64.Checksum
    10  // returns the CRC-64 checksum of data using the ECMA polynomial.
    11  func Sum64(data []byte) uint64 {
    12  	return crc64.Checksum(data, crc64Table)
    13  }
    14  
    15  // Sum64String run crc64.Checksum
    16  // returns the CRC-64 checksum of data using the ECMA polynomial.
    17  func Sum64String(str string) uint64 {
    18  	return crc64.Checksum([]byte(str), crc64Table)
    19  }