File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ import hashlib
2+
3+
4+ # can test here: http://www.sha1-online.com/
5+
6+ def convert_to_md5 (password ):
7+ return hashlib .md5 (password ).hexdigest ()
8+
9+
10+ def convert_to_sha1 (password ):
11+ return hashlib .sha1 (password ).hexdigest ()
12+
13+
14+ def convert_to_sha256 (password ):
15+ return hashlib .sha256 (password ).hexdigest ()
Original file line number Diff line number Diff line change 1+ import csv
2+ import string
3+
4+ def read_password_base ():
5+ base_file_path = 'base.txt'
6+
7+ with open (base_file_path , 'r' ) as csvfile :
8+ base_reader = csv .reader (csvfile , delimiter = '|' )
9+ return list (base_reader )
10+
11+ def ceaser_decrypt (message , shift ):
12+ message = message .lower ()
13+
14+ secret = ""
15+ for c in message :
16+ if c in "abcdefghijklmnopqrstuvwxyz" :
17+ num = ord (c )
18+ num += shift
19+ if num > ord ("z" ): # wrap if necessary
20+ num -= 26
21+ elif num < ord ("a" ):
22+ num += 26
23+ secret = secret + chr (num )
24+ else :
25+ # don't modify any non-letters in the message; just add them as-is
26+ secret = secret + c
27+ return secret
28+
29+
30+ def decrypt_base_password (base ):
31+ print "decrypt"
32+ for line in base :
33+ for line in base :
34+ print "before %s" % line [1 ]
35+ print "after %s" % ceaser_decrypt (line [1 ], - 12 )
36+
37+
38+ base = read_password_base ()
39+ decrypt_base_password (base )
You can’t perform that action at this time.
0 commit comments