terraform-provider-libvirt/libvirt/helper/hashcode/checksum.go

18 lines
197 B
Go

package hashcode
import (
"hash/crc32"
)
func String(s string) int {
v := int(crc32.ChecksumIEEE([]byte(s)))
if v >= 0 {
return v
}
if -v >= 0 {
return -v
}
// v == MinInt
return 0
}