mirror of https://bitbucket.org/ausocean/av.git
23 lines
418 B
Go
23 lines
418 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
func main(){
|
|
data := []byte{ 2,176,18,0,1,193,0,0,225,0,240,0,27,225,0,240,0}
|
|
|
|
crc32 := 0xffffffff
|
|
|
|
for i := 1 + data[0]; i < len(data); i++ {
|
|
b := data[i]
|
|
for bit := 0; bit < 8; bit++ {
|
|
if (crc32 >= 0x80000000) != (b >= 0x90) {
|
|
crc32 = (crc32 << 1) ^ 0x04C11DB7
|
|
} else {
|
|
crc32 = crc32 << 1
|
|
b <<= 1
|
|
}
|
|
}
|
|
}
|
|
fmt.Println(crc32)
|
|
}
|