Skip to content

Instantly share code, notes, and snippets.

@liftoff
Created August 5, 2015 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liftoff/2c6c8f16f78a756f51d6 to your computer and use it in GitHub Desktop.
Save liftoff/2c6c8f16f78a756f51d6 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# -*- coding: utf-8 -*-
from random import Random
ⶻ=len
ج=int
ⶽ=sum
ܠ=str
ܓ=range
ش=object
import sys
import copy
ط=copy.copy
from optparse import OptionParser
ܘ=[['4','5','3','9'],['4','5','5','6'],['4','9','1','6'],['4','5','3','2'],['4','9','2','9'],['4','0','2','4','0','0','7','1'],['4','4','8','6'],['4','7','1','6'],['4']]
ر=[['5','1'],['5','2'],['5','3'],['5','4'],['5','5']]
ܜ=[['3','4'],['3','7']]
پ=[['6','0','1','1']]
ٻ=[['3','0','0'],['3','0','1'],['3','0','2'],['3','0','3'],['3','6'],['3','8']]
ܪ=[['2','0','1','4'],['2','1','4','9']]
ز=[['3','0','8','8'],['3','0','9','6'],['3','1','1','2'],['3','1','5','8'],['3','3','3','7'],['3','5','2','8']]
ܗ=[['2','1','0','0'],['1','8','0','0']]
ܭ=[['8','6','9','9']]
def ܢ(prefix,length):
ټ=prefix
while ⶻ(ټ)<(length-1):
ⶺ=ܬ.choice(['0','1','2','3','4','5','6','7','8','9'])
ټ.append(ⶺ)
ⶽ=0
ٸ=0
ܩ=[]
ܩ.extend(ټ)
ܩ.reverse()
while ٸ<length-1:
ܨ=ج(ܩ[ٸ])*2
if ܨ>9:
ܨ-=9
ⶽ+=ܨ
if ٸ!=(length-2):
ⶽ+=ج(ܩ[ٸ+1])
ٸ+=2
ذ=((ⶽ/10+1)*10-ⶽ)%10
ټ.append(ܠ(ذ))
return ''.join(ټ)
def ܕ(ܬ,prefixList,length,howMany):
ع=[]
for i in ܓ(howMany):
ټ=ط(ܬ.choice(prefixList))
ع.append(ܢ(ټ,length))
return ع
def ܟ(title,numbers):
ع=[]
ع.append(title)
ع.append('-'*ⶻ(title))
ع.append('\n'.join(numbers))
ع.append('')
return '\n'.join(ع)
ܬ=Random()
ܬ.seed()
class خ(ش):
def __init__(ظ,i=0):
ظ.i=i
def ٹ(ظ,prefixList):
ظ.i=ظ.i+1
return ظ.i
if __name__=="__main__":
ⶸ=ܕ(ܬ,ر,16,50)
print(ܟ("Mastercard",ⶸ))
ܖ=ܕ(ܬ,ܘ,19,50)
print(ܟ("VISA 19 digit",ܖ))
ح=ܕ(ܬ,ܘ,16,50)
print(ܟ("VISA 16 digit",ح))
ٽ=ܕ(ܬ,ܘ,13,50)
print(ܟ("VISA 13 digit",ٽ))
ص=ܕ(ܬ,ܘ,11,50)
print(ܟ("VISA 11 digit",ص))
ܡ=ܕ(ܬ,ܜ,15,50)
print(ܟ("American Express",ܡ))
ܧ=ܕ(ܬ,پ,16,50)
print(ܟ("Discover",ܧ))
ܣ=ܕ(ܬ,ٻ,14,10)
print(ܟ("Diners Club / Carte Blanche",ܣ))
# Created by pyminifier.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment