Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Scripts to export hashed IP/mobile phone numbers in Japan as CSV text files
#!/usr/bin/env python
import hashlib
prefix = ['050','070','080','090'];
x = 1000; # mobile/IP phone number will be starts with 1, not 0
column = ['NUMBER','MD5','SHA1','SHA256','SHA384','SHA512'];
print(format('"%s"' % ('", "'.join(column))))
for p in prefix:
while x <= 9999:
y = 0;
while y <= 9999:
number = format('%s%04d%04d' % (p,x,y))
output_list = [
number, # numbers
hashlib.md5(number).hexdigest(), # number by md5
hashlib.sha1(number).hexdigest(), # number by sha1
hashlib.sha256(number).hexdigest(), # number by sha256
hashlib.sha384(number).hexdigest(), # number by sha384
hashlib.sha512(number).hexdigest() # number by sha512
]
print(format('"%s"' % ('","'.join(output_list))))
y = y+1
x = x+1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment