Skip to content

Instantly share code, notes, and snippets.

@kristofgilicze
Created August 3, 2022 16:12
Show Gist options
  • Save kristofgilicze/57e4cad4c5029f6faece20acc4fef735 to your computer and use it in GitHub Desktop.
Save kristofgilicze/57e4cad4c5029f6faece20acc4fef735 to your computer and use it in GitHub Desktop.
Calculate NMEA checksum
def calculate_nmea_checksum(sentence: str) -> bool:
checksum = 0
payload = sentence.raw.split("*")[0][1:]
for byte in payload:
checksum ^= ord(byte)
return checksum == sentence.checksum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment