Skip to content

Instantly share code, notes, and snippets.

@laoyur
Created October 1, 2016 09:18
Show Gist options
  • Save laoyur/08cf96cad3c76815224cfc203fd43bb3 to your computer and use it in GitHub Desktop.
Save laoyur/08cf96cad3c76815224cfc203fd43bb3 to your computer and use it in GitHub Desktop.
Python version of https://www.v2ex.com/t/309785
import hashlib
import datetime
def next_wechat_substr(current):
for c in chrs:
yield current + c
def md5(s):
return hashlib.md5(s).hexdigest()
start = datetime.datetime.now()
chrs = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
final_hash = '3bed22f7f496e84b035a996522baa7594c27c7e5718a78bfddf9012904b70eb755d67f90c8de149ead7ee674b024f38c216642030c2d54cb1dd657dd66342c99c239f3c31fd399fc052a9b7861f2073d2b9f47811dd77fd544d570c34bf5f349d110389979571714694a5054238465ca38ba26c25fb1a32b4d0a3b93666b09b3'
final_hash_len = len(final_hash)
count = final_hash_len / 32
hash_list = [final_hash[i:i+32] for i in range(0, final_hash_len, 32)]
v2ex_md5 = md5('v2ex')
wechat = ''
for i in range(0, count):
for wx in next_wechat_substr(wechat):
if md5(v2ex_md5 + wx + md5(wx)) == hash_list[i]:
wechat = wx
break
print wechat
print datetime.datetime.now() - start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment