Created
May 10, 2020 09:13
-
-
Save c4mx/106a0e48a9000831e13ae49b2e9205e8 to your computer and use it in GitHub Desktop.
Calculate WPS pin checksum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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