B.3 Examples for Chapter 2

Example 1

A shift cipher was used to obtain the ciphertext kddkmu. Decrypt it by trying all possibilities.

> allshifts("kddkmu")
                        "kddkmu"
                        "leelnv"
                        "mffmow"
                        "nggnpx"
                        "ohhoqy"
                        "piiprz"
                        "qjjqsa"
                        "rkkrtb"
                        "sllsuc"
                        "tmmtvd"
                        "unnuwe"
                        "voovxf"
                        "wppwyg"
                        "xqqxzh"
                        "yrryai"
                        "zsszbj"
                        "attack"
                        "buubdl"
                        "cvvcem"
                        "dwwdfn"
                        "exxego"
                        "fyyfhp"
                        "gzzgiq"
                        "haahjr"
                        "ibbiks"
                        "jccjlt"

As you can see, attack is the only word that occurs on this list, so that was the plaintext.

Example 2

Encrypt the plaintext message cleopatra using the affine function 7x+8:

> affinecrypt("cleopatra", 7, 8)

                           "whkcjilxi"

Example 3

The ciphertext mzdvezc was encrypted using the affine function 5x+12. Decrypt it.

SOLUTION

First, solve y5x+12(mod ...

Get Introduction to Cryptography with Coding Theory, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.