Skip to content

Instantly share code, notes, and snippets.

@larytet
Last active August 21, 2017 10:07
Show Gist options
  • Save larytet/56de5228342f8430f48c5b13faf81346 to your computer and use it in GitHub Desktop.
Save larytet/56de5228342f8430f48c5b13faf81346 to your computer and use it in GitHub Desktop.
Password cards
#!/usr/bin/env python
# See also http://www.averk.net/passgen.html
# https://www.passwordcard.org/en
'''
The script will output something like
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
1 W j ~ E ^ y x ! N q S ! r e e g a q f P c Q : q & Q
2 j E y ! q ! e g q P Q q Q u S h r x . r , R ~ R H =
3 ~ y N ! e q c q q S A x D , g R l P , . P a g I Q D
4 E ! ! g P q u h x r R R = t . p z I G R D W # O - L
5 ^ q e P & S X r g H ^ . C * Q R , + a - n T t % f M
6 y ! q q S x , R P . a I D D + O d s : % T q $ x h G
7 x e c u X , M t P * . D r Y n u l T y P s ^ k w e J
8 ! g q h r R t p I R W O L u % E ! x t $ w U ! e C u
9 N q q x g P P I z + ? s ? T l x @ # % A i f q b U r
0 q P S r H . * R + - T % M P h $ C A . C Q ? E w x N
1 S Q A R ^ a . W ? T @ q R ^ F U . f _ ? h + K k k X
2 ! q x R . I D O s % q x G w A e Z b V w T k @ o e C
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
1 6 8 s K b q A x Q e b l R h 7 N b V b F L e c i k 0
2 8 K q x e l h N V F e i 0 G k I d d 5 3 V q F I i h
3 s q Q l 7 V L i Y k 2 d j V R I B a u s 9 X 4 E z p
4 K x l N F i G I d 3 q I h l s P s E L q J h h j e S
5 b e 7 F k k i 3 R i m s K A z q a T y e H b J Q P 2
6 q l V i k d V I a s X E p J T j 1 5 R Q c n Y Y w X
7 A h L G i V c l 9 A z J 7 y H e F c f I r Z X m N 2
8 x N i I 3 I l P E q h j S e Q 4 q Y Z W m 1 g R 9 B
9 Q V Y d R a 9 E b T B 5 2 c 8 Y v a j G 9 6 A n O 2
0 e F k 3 i s A q T e b Q 2 I w W W G U 9 9 K k Z T S
1 b e 2 q m X z h B b 1 n 5 Z s 1 4 6 R K 1 w k l O N
2 l i d I s E J j 5 Q n Y X m G R 4 n M Z q l N W t K
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
1 9 9 6 6 7 2 9 8 2 2 6 4 3 8 8 8 1 5 5 9 3 0 5 0 0 1
2 9 6 2 8 2 4 8 8 5 9 0 0 1 4 8 6 6 1 0 3 8 3 2 7 5 0
3 6 2 2 4 8 5 3 0 0 8 0 1 3 8 8 7 7 0 3 1 3 1 5 3 0 9
4 6 8 4 8 9 0 4 6 1 3 3 7 0 7 1 3 2 3 7 0 7 1 0 7 3 0
5 7 2 8 9 0 8 6 3 8 5 1 1 7 6 0 0 5 1 1 3 2 2 9 1 7 1
6 2 4 5 0 8 1 8 7 0 1 1 3 9 7 1 7 7 0 7 1 1 3 2 7 0 8
7 9 8 3 4 6 8 0 7 3 6 6 7 6 5 2 3 4 1 7 3 8 5 5 8 6 5
8 8 8 0 6 3 7 7 3 3 0 1 7 0 3 1 9 4 7 4 1 8 0 0 9 2 4
9 2 5 0 1 8 0 3 3 2 1 4 0 2 1 5 7 5 1 4 5 1 5 8 6 0 7
0 2 9 8 3 5 1 6 0 1 3 2 1 1 3 0 1 7 5 8 2 8 9 1 4 1 7
1 6 0 0 3 1 1 6 1 4 2 0 3 9 5 2 0 2 5 0 9 5 8 0 6 7 6
2 4 0 1 7 1 3 7 7 0 1 3 7 8 8 5 9 5 6 8 4 5 6 9 9 4 2
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
1 A S J X 3 J 6 5 3 N N B Z K L 9 B I X G P C C L 3 Y
2 S X J 5 N B K 9 I G C L Y 6 0 E 2 D S Z 6 L W V R 4
3 J J 3 B L I P L H 0 1 D 6 6 T V U Y O 9 M 0 H S E E
4 X 5 B 9 G L 6 E D Z L V 4 M 9 5 D S 2 5 D D N S J H
5 3 N L G 3 0 Z Z T R 5 9 U M E 5 H 0 J J 4 R D P 0 R
6 J B I L 0 D 6 V Y 9 0 S E D 0 S 3 1 Y P H T 5 Q Y V
7 6 K P 6 Z 6 I M M M J D A 3 4 L P H W G Y 0 J G P X
8 5 9 L E Z V M 5 S 5 D S H L P K M Q M P G O L X T 7
9 3 I H D T Y M S Y 0 2 1 Z H G Q E W S H Z G Q L 8 N
0 N G 0 Z R 9 M 5 0 J R P R G Y P E H V T P M 3 X F 6
1 N C 1 L 5 0 J D 2 R 9 T B 0 5 O D G R M Y Q Q C I 4
2 B L D V 9 S D S 1 P T Q V G H X 1 L U X 0 C N K B 3
'''
import string
import random
def generate_list(use_special_chars, use_uppercase, use_lowercase, use_numbers):
result = []
if use_lowercase:
result = result + list(string.ascii_lowercase)
if use_uppercase:
result = result + list(string.ascii_uppercase)
if use_numbers:
result = result + list("0123456789")
if use_special_chars:
result = result + list("~!@#$%^&*_+-=?.,:")
while len(result) < 512:
result = result + result;
return result
def generate_card(use_special_chars, use_uppercase, use_lowercase, use_numbers):
letters = generate_list(use_special_chars, use_uppercase, use_lowercase, use_numbers)
random.shuffle(letters)
return letters
def print_card(letters):
columns = range(ord('A'), ord('Z')+1)
print " ",
for column in columns:
print chr(column),
print
lines = range(1,13)
for line in lines:
print line%10,
for column in columns:
idx = line*(1+column-ord('A'))
letter = letters[idx]
print letter,
print
letters = generate_card(True, True, True, False)
print_card(letters)
print
letters = generate_card(False, True, True, True)
print_card(letters)
print
letters = generate_card(False, False, False, True)
print_card(letters)
print
letters = generate_card(False, True, False, True)
print_card(letters)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment