PYTHON
CRYPTOGRAPHY – NOMENCLATOR CIPHER

 

 

DESCRIPTION


You will write code related to the Nomenclator cipher that can be used in encrypting/decrypting messages.


THE NOMENCLATOR CIPHER

 

The Nomenclator ciper is a small variation to the standard substitution cipher.  However, when replacing a letter, instead of using another letter, we use a word.  This requires that we memorize all the words or have a table of letters and associated words.

 

EXAMPLE

 

Let’s assume the following letters have the following words associated with them:

 

A -> BRYCE
B -> MIKE

C -> JONAH

D -> PAT
E -> AMBER

F -> MAZZA
and so on…


We can then encrypt the world FADE to MAZZABRYCEPATAMBER. 

 

Or, we can decrypt JONAHBRYCEMIKE to CAB.

 

 

Of course, for real-world usage, a more advanced version of this cipher was used where combinations of letters would be associated with a word.  In fact, the combinations would sometimes even vary in length.  This could lead to a big dictionnary-like lookup table for encrypting/decrypting.

 

WORK

 

QUESTION 1

Consider the following conversion table for a Nomenclature cipher:

 

A -> MAZZY
B -> KYLIE

C -> WYATT

D -> BRYCE
E -> EVAN

F -> CONNOR

G -> BLAKE

H -> JAMESON

I -> AMBER
J -> MICHAEL

K -> JONAH

L -> MATTIAS

M -> RYAN

N -> LENNON

O -> CONNER

P -> KYARA

Q -> ATHARVA

R -> SANDRO

S -> MICHO

T -> DYLAN

U -> DARREN

V -> NATHAN

W -> JANE

X -> ETHAN

Y -> PATRICK

Z -> CAMPEAU

 

 

 

In a Python file called Nomenclature, write the enc and dec functions for the above Nomenclature cipher.  They only need to work with upper case letters.

 

enc (word)

dec (word)

 

Test your code.

 

Feel free to use any of your past code in here.

 

Note: I think the decode function might be a little challenging.  Please see me if you are stuck.

 

QUESTION 2

 

The following sentence has been encrypted using the above Nomenclature cipher.  Use your program to decrypt it.

 

JANEJAMESONEVANLENNONLENNONAMBERLENNONEVANJAMESONDARRENLENN

ONBRYCESANDROEVANBRYCEPATRICKEVANMAZZYSANDROMICHOCONNERMATT

IASBRYCEPATRICKCONNERDARRENSANDROEVANMAZZYWYATTJAMESONMATTI

ASCONNERCONNERJONAHMAZZYMICHOBLAKECONNERCONNERBRYCEPATRICKC

ONNERCARRENJANEAMBERMATTIASMATTIASLENNONCONNERDYLAN

 

(Hopefully, I didn’t make an error when encrypting this!)