github.com/songzhibin97/gkit@v1.2.13/internal/sys/hash/hash.go (about)

     1  package hash
     2  
     3  import "hash/crc32"
     4  
     5  func Uint16(s string, table *crc32.Table) uint16 {
     6  	return uint16(crc32.Checksum([]byte(s), table))
     7  }
     8  
     9  func Uint32(s string, table *crc32.Table) uint32 {
    10  	return crc32.Checksum([]byte(s), table)
    11  }
    12  
    13  func Uint16IEEE(s string) uint16 {
    14  	return uint16(crc32.ChecksumIEEE([]byte(s)))
    15  }
    16  
    17  func Uint32IEEE(s string) uint32 {
    18  	return crc32.ChecksumIEEE([]byte(s))
    19  }