Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

"""Character Sets 

 

Defines strings of characters and an exclude function that can be used either as 

the alphabets for you character-base passwords or as building blocks used to 

construct a new alphabet for you passwords. 

 

Example: 

To create an alphabet with all characters except tabs use either: 

'alphabet': exclude(PRINTABLE, '\t') 

or: 

'alphabet': ALPHANUMERIC + PUNCTUATION + ' ' 

""" 

 

# Exclude function 

def exclude(chars, exclusions): 

"""Exclude Characters 

 

Use this to strip characters from a character set. 

""" 

try: 

# this version is compatible with python3 

return chars.translate(str.maketrans('', '', exclusions)) 

except AttributeError: 

# this version is compatible with python2 

return chars.translate(None, exclusions) 

 

# Character sets 

# Use these to construct alphabets by summing together the ones you want. 

LOWERCASE = "abcdefghijklmnopqrstuvwxyz" 

UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 

LETTERS = LOWERCASE + UPPERCASE 

DIGITS = "0123456789" 

ALPHANUMERIC = LETTERS + DIGITS 

HEXDIGITS = "0123456789abcdef" 

PUNCTUATION = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~""" 

SYMBOLS = exclude(PUNCTUATION, r"""'"`\\""") 

WHITESPACE = " \t" 

PRINTABLE = ALPHANUMERIC + PUNCTUATION + WHITESPACE 

DISTINGUISHABLE = exclude(ALPHANUMERIC, 'Il1O0')