Mercurial > public > m209
annotate examples/encrypt.py @ 64:72e0bda6df40
Split key list docs into own source file.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 20 Jul 2013 13:26:25 -0500 |
parents | 9341896b93f0 |
children |
rev | line source |
---|---|
bgneal@55 | 1 """Example of how to perform an encrypt operation using the standard |
bgneal@55 | 2 procedure. Assumes a key file named m209keys.cfg exists in the current directory |
bgneal@55 | 3 and contains the key list with indicator MB. |
bgneal@55 | 4 |
bgneal@55 | 5 """ |
bgneal@55 | 6 from m209.procedure import StdProcedure |
bgneal@55 | 7 from m209.keylist.config import read_key_list |
bgneal@55 | 8 |
bgneal@55 | 9 key_list = read_key_list('m209keys.cfg', 'MB') |
bgneal@55 | 10 if key_list: |
bgneal@55 | 11 proc = StdProcedure(key_list=key_list) |
bgneal@55 | 12 plaintext = "THE PIZZA HAS ARRIVED STOP NO SIGN OF ENEMY FORCES STOP" |
bgneal@55 | 13 msg = proc.encrypt(plaintext, spaces=True, ext_msg_ind='PDUFHL', sys_ind='I') |
bgneal@55 | 14 print(msg) |
bgneal@55 | 15 else: |
bgneal@55 | 16 print("Key list MB not found") |