Mercurial > public > m209
comparison examples/decrypt.py @ 55:9341896b93f0
Added library tutorial documentation.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Fri, 05 Jul 2013 19:32:45 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
54:7fd3ec5580ab | 55:9341896b93f0 |
---|---|
1 """Example of how to perform a decrypt operation using the standard | |
2 procedure. Assumes a key file named m209keys.cfg exists in the current directory | |
3 and contains the key list with indicator MB. | |
4 | |
5 """ | |
6 from m209.procedure import StdProcedure | |
7 from m209.keylist.config import read_key_list | |
8 | |
9 msg = ('IIPDU FHLMB LASGD KTLDO OSRMZ PWGEB HYMCB IKSPT IUEPF FUHEO NQTWI VTDPC' | |
10 ' GSPQX IIPDU FHLMB') | |
11 | |
12 proc = StdProcedure() | |
13 params = proc.set_decrypt_message(msg) | |
14 key_list = read_key_list('m209keys.cfg', params.key_list_ind) | |
15 if key_list: | |
16 proc.set_key_list(key_list) | |
17 plaintext = proc.decrypt() | |
18 print(plaintext) | |
19 else: | |
20 print("Key list '{}' not found".format(params.key_list_ind)) |