Clarification of Question by
amber12345-ga
on
19 Nov 2002 15:15 PST
i have tried to cut out has much has i can from my document which is
twelve pages long, below are sites with examples of the vigenere
square
i have a week to solve the questions below
I am using the compiler Hugs for windows 98 from the haskell site
http://www.greenhodge.net/g/play/crypto/vigenere-explan.shtml
http://www.trincoll.edu/depts/cpsc/cryptography/vigenere.html
Let us presume that P consists of lower case letters (a - z) only and
it is
P = ''meeting at dawn in the garden''
K consists of capital letters (A-Z) only and is assumed to be
K = mystery
To encrypt the message, we align the letters of P underneath those of
(repeats of) K:
M Y S T E R Y M Y S T E R Y M Y S T E R Y M Y S
M e e t I n g a t d a w n I n t h e g a r d e n
Each of the above 24 pairs of letters is mapped to a letter of the
cipher text according to the Vigenere Square whose rows and columns
are accordingly indexed by upper- and lowercase letters. Respectively.
So, for example, the first pair (M , m) is mapped to Y, the second
pair ( Y , e ) is mapped to C, the third pair ( S , e ) is mapped to W
etc.
Task 1.
Define a function: IO () which displays the Vigenere Square on the
terminal
example
Define function rotations: [a] -> [[a]] which for any list returns the
list of all its rotations
Example
Define a function all-rotations Cw2002> all-rotations [1.2, 3, 4, 5]
[(1,2.3,4,5),(2,3,4,5,1),(3,4,5,1,2),(4,5,1,2,3),(5,1,2,3,4)]
Which displays the Vigenere Square on the terminal; I have used
numbers instead of letters for this example
Complete list-of-lists representation of the Vigenere Square is
achieved by some additional steps involving mapping operations
concerned with scatting on the edges'. Then print the result.
Task 2
Define a function vigenere-asciI: 10 ( ) except that now each
character is represented by its respective ASCII code. Which displays
the Vigenere Square except that now each character is represented by
its respective ASCII CODE
Task 3
Define a function ASCII c: Int -> Int -> Int: which returns the ASCII
value of the cipher letter
Given the ASCII value of a key word letter and that of a plain-text
letter Example: prompt > ASCII_C 7 1 110
Returns 84
Prompt >ASCII_C 85 113
Returns 75
Task 4 Now use ASCII -c to define a function v-cipher: Char ->
Char-> Char
Which returns the cipher letter, given a key word letter and a plain
text letter Example
Prompt > v cipher ' N E
Returns R
Task 5.
Now, use v-cipher to define the function cipher String ->String ->
String
Whose functionality has been exemplified below
Prompt > cipher ''MYSTERY'' ''meetingatda|inthegarden''
''YCWMMEEMRVTAEGZRZXKRPPCF''
Prompt > decipher ''MYSTERY'' ''YCWMMEEMRVTAEGZRZXKRPPCF''
''meetingatda|inthegarden''