Skip to content

Instantly share code, notes, and snippets.

@c4mx
Created May 10, 2020 09:13
Show Gist options
  • Save c4mx/106a0e48a9000831e13ae49b2e9205e8 to your computer and use it in GitHub Desktop.
Save c4mx/106a0e48a9000831e13ae49b2e9205e8 to your computer and use it in GitHub Desktop.
Calculate WPS pin checksum
#!/usr/bin/env python3
def wps_pin_checksum(pin):
if pin > 9999999 or pin < 1000000:
print("[-] Input should be 6 digits")
return None
accum = 0
while pin:
accum += 3 * (pin % 10)
pin //= 10
accum += pin % 10
pin //= 10
return (10 - accum % 10) % 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment