moto-flash-data/s19/checksum.go
2025-01-20 13:10:35 +01:00

12 lines
246 B
Go

package s19
import "strconv"
func validateChecksum(line string, checksum byte) bool {
sum := byte(0)
for i := 2; i < len(line)-2; i += 2 {
value, _ := strconv.ParseUint(line[i:i+2], 16, 8)
sum += byte(value)
}
return ^sum == checksum
}