equal
deleted
inserted
replaced
34 return _CYPHERERS[seed] |
34 return _CYPHERERS[seed] |
35 |
35 |
36 |
36 |
37 def encrypt(data, seed): |
37 def encrypt(data, seed): |
38 string = pickle.dumps(data) |
38 string = pickle.dumps(data) |
39 string = string + '*' * (8 - len(string) % 8) |
39 string = string + b'*' * (8 - len(string) % 8) |
40 string = b64encode(_cypherer(seed).encrypt(string)) |
40 string = b64encode(_cypherer(seed).encrypt(string)) |
41 return unicode(string) |
41 return string.decode('utf-8') |
42 |
42 |
43 |
43 |
44 def decrypt(string, seed): |
44 def decrypt(string, seed): |
|
45 string = string.encode('utf-8') |
45 # pickle ignores trailing characters so we do not need to strip them off |
46 # pickle ignores trailing characters so we do not need to strip them off |
46 string = _cypherer(seed).decrypt(b64decode(string)) |
47 string = _cypherer(seed).decrypt(b64decode(string)) |
47 return pickle.loads(string) |
48 return pickle.loads(string) |