Google Answers Logo
View Question
 
Q: Haskell Vigenere Cipher ( No Answer,   1 Comment )
Question  
Subject: Haskell Vigenere Cipher
Category: Computers
Asked by: amber12345-ga
List Price: $40.00
Posted: 17 Nov 2002 17:14 PST
Expires: 17 Dec 2002 17:14 PST
Question ID: 109560
Drear/sir/madam 

I have been given a peace of work to do, which involves a Vigenere
Cipher in Haskell

The work has to be in Haskell, the work involves a few things like
having to display the Vigenere Cipher on the terminal and also
displaying it has its ASCII numbers

If you are interested I will scan the work, in to a word document so
you can look at it so you will understand better what I need, if you
will please give me you e-mail address I will send it to you

Request for Question Clarification by rbnn-ga on 18 Nov 2002 08:20 PST
In order for us to answer the question, you will need either to post
the information here or point us to a URL where the information may be
found.

Clarification of Question by amber12345-ga on 18 Nov 2002 17:43 PST
1 define a function which displays a Vigenere Square on the terminal

2 Define a function which displays a Vigenere Square has the
equivalent ASCII numbers instead of letters

3 Define a function ASCII : : Int -> Int -> Int which returns the ASCH
value of the cipher letter, given the ASCII value of a key word letter
and that of a plain text letter
Example 71 110
84 

4 Define a function Char-> Char-> Char which return the cipher letter
given a keyword and a plain text letter

Example ‘n’ ‘e’
‘R’

Request for Question Clarification by rbnn-ga on 18 Nov 2002 18:38 PST
1. What compiler are you using? What platform?

2. I do not understand the signature 

4 Define a function Char-> Char-> Char which return the cipher letter
given a keyword and a plain text letter
 

You mention a "keyword" but your signature is only for a Char. I don't
quite understand here. Is it a one-character keyword?

You might want to post the exact definition of Vigenere cipher you are
using. Normally as I mentioned, in this cipher you are giving a
keyword (that is a [Char] not a Char) and a message (also a [Char])
and you are trying to encrypt one.

Clarification of Question by amber12345-ga on 19 Nov 2002 07:39 PST
My e-mail address is on http://www.kasamba.com/

Under  public board Computers & Internet (19) 

my question is 

I am after help with a Vigenere Cipher, in the Haskell programming language  

You will see my e-mail address under the question, if you would please send 
Me your e-mail address, I can then send you the a scanned document so you will
Understand my question better

Request for Question Clarification by rbnn-ga on 19 Nov 2002 09:08 PST
Hi amber,

Google Researchers are not allowed to contact questioners other than
through this board. Can you simply type in what is scanned?

If not, I will try and find a site to which you upload your image, but
I may not be able to do so.

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''
Answer  
There is no answer at this time.

Comments  
Subject: Re: Haskell Vigenere Cipher
From: feilong-ga on 17 Nov 2002 17:20 PST
 
Sorry Amber but we are not allowed to give our personal e-mail
addresses. Just post whatever you want to show us somewhere in the
Internet and then give us the link here. That would be enough. We hope
you understand.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy