Mercurial > public > m209
diff docs/index.rst @ 55:9341896b93f0
Added library tutorial documentation.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Fri, 05 Jul 2013 19:32:45 -0500 |
parents | 7fd3ec5580ab |
children | 21627ec5b1ad |
line wrap: on
line diff
--- a/docs/index.rst Fri Jul 05 14:18:52 2013 -0500 +++ b/docs/index.rst Fri Jul 05 19:32:45 2013 -0500 @@ -144,12 +144,41 @@ Library Tutorial ---------------- +Here is one way to perform the encrypt and decrypt operations from the +command-line tutorial, above. In order to produce the same output, we explicity +specify the encryption parameters: the key list, the external message +indicator, and the system indicator. These parameters are explained in the +reference documentation. + +.. literalinclude:: ../examples/encrypt.py + +This program outputs:: + + IIPDU FHLMB LASGD KTLDO OSRMZ PWGEB HYMCB IKSPT IUEPF FUHEO NQTWI VTDPC GSPQX IIPDU FHLMB + +A decrypt is just a bit more complicated. After constructing a ``StdProcedure`` +object, you hand it the encrypted message to analyze. The procedure object +examines the groups in the message and extracts all the indicators. These are +returned as a ``DecryptParams`` named tuple which indicates, amongst other +things, what key list is required. It is then up to you to obtain this key list +somehow. Here we use the ``read_key_list()`` function to do so. After +installing the key list into the procedure object, you can finally call +``decrypt()``: + +.. literalinclude:: ../examples/decrypt.py + +This program prints:: + + THE PI A HAS ARRIVED STOP NO SIGN OF ENEMY FORCES STOP + + Requirements ------------ ``m209`` is written in Python_, specifically Python 3.3. It has no other requirements or dependencies. + Installation ------------ @@ -159,8 +188,8 @@ $ pip install m209 # install $ pip install --upgrade m209 # upgrade -You may also download a tarball or .zip file of the latest code using the "get -source" link on the `m209 Bitbucket page`_. Alternatively if you use +You may also download a tarball or .zip file of the latest code by visiting the +Downloads tab on the `m209 Bitbucket page`_. Alternatively if you use Mercurial_, you can clone the repository with the following command:: $ hg clone https://bitbucket.org/bgneal/m209