Skip to content

Instantly share code, notes, and snippets.

@gerry
Created May 7, 2010 22:45
Show Gist options
  • Save gerry/394104 to your computer and use it in GitHub Desktop.
Save gerry/394104 to your computer and use it in GitHub Desktop.
# Calculate the lower 6 bytes of the WEP key, the upper 4 are from the MAC
# address of the router (1801 or 1F90)
def get_key(essid):
key = sum(int(val, 36) * (36**idx) for idx, val in enumerate(essid))
return hex(key)
# >>> print get_key("E3X12")
# 0x349fca
# or as a one liner:
print hex(sum(int(val, 36) * (36**idx) for idx, val in enumerate(essid)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment