Skip to content

Instantly share code, notes, and snippets.

@shawwwn
shawwwn / uping.py
Last active Mar 28, 2021
µPing: Ping library for MicroPython
View uping.py
# µPing (MicroPing) for MicroPython
# copyright (c) 2018 Shawwwn <shawwwn1@gmail.com>
# License: MIT
# Internet Checksum Algorithm
# Author: Olav Morken
# https://github.com/olavmrk/python-ping/blob/master/ping.py
# @data: bytes
def checksum(data):
if len(data) & 0x1: # Odd number of bytes