8.5 Summary

In this chapter, we explored cryptanalysis by implementing techniques for reading encrypted text. We utilized many previously introduced features of Python, including lists and dictionaries, but we extended these ideas by using lists and dictionaries as containers for other lists and dictionaries. We used a brute-force solution to systematically solve a challenging problem. Part of that solution introduced a pattern called “minmax” for systematically finding a “better” answer given a “best” answer so far. Finally, we introduced the notion of a regular expression and showed how this powerful pattern-matching tool can help us locate missing letters in partially decrypted text.

Key Terms

  • brute-force method

  • capture group

  • column-major order

  • cryptanalysis

  • frequency analysis

  • in-place sort

  • minmax pattern

  • pattern matching

  • rail fence cipher

  • regular expression

  • row-major order

  • substitution cipher

Python Functions, Methods, and Keywords

  • findall

  • group

  • groups

  • join

  • match

  • setdefault

  • sort

  • sub

  • zip

Programming Exercises

  1. 8.1     Decode the following paragraph:

    jyn fg jggtwj djtfcn stf sjyn edcyjnc ia zy stes fjqtye z wzdn owcff gstf gsq sjyn edcyjnc gsjg mtgs tg gszi xjqcfg owzm gstyc cycxtcf gz gtyq otgf ty gsq xcdhq jyn gsc wzdn ntn edty jyn aczawc ntn lcjfg iazy gsc wjxof jyn fwzgsf jyn hjda jyn jyhszktcf jyn zdjyeigjyf jyn odcjvljfg hcdcjwf jyn lditg ojgf jyn gsc wzdn fajvc fjqtye ltdfg fsjwg gszi gjvc zig gsc szwq aty gscy fsjwg gszi hziyg gz gsdcc yz xzdc yz wcff gsdcc fsjwg oc gsc yixocd gszi fsjwg hziyg jyn gsc yixocd zl gsc hziygtye fsjwg oc gsdcc lzid fsjwg gszi yzg hziyg yctgscd hziyg gszi gmz cphcagtye gsjg gszi gscy adzhccn gz gsdcc ltkc tf dtesg zig zyhc gsc yixocd gsdcc octye gsc gstdn yixocd oc dcjhscn gscy wzoocfg gszi gsq szwq sjyn edcyjnc zl jygtzhs gzmjdnf gszi lzc msz octye yjiesgq ty xq ftesg fsjww fyill tg

  2. 8.2     Working with a partner, pick two paragraphs of text from a current newspaper. Encrypt the paragraphs separately and trade the resulting ciphertext. Use the techniques in this chapter to decode the message from your partner.

Design Credits: Calculator Icon made by Smashicons from www.flaticon.com

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.202.123