Posted: Tue Nov 10, 2009 4:29 pm Post subject: How to do vigenere cipher??
What is it you are trying to achieve?
How to do vigenere cipher??
Can someone post a solution to help me plz?
Thank you
Sponsor Sponsor
DtY
Posted: Tue Nov 10, 2009 5:15 pm Post subject: RE:How to do vigenere cipher??
Are you looking for a solution, or help?
If you just want help, you'll want to start with a simple caeser cipher. Once you get that, it should be relatively simple to apply a different one on each letter for the vigenere cipher.
nelsonkkyy
Posted: Tue Nov 10, 2009 5:49 pm Post subject: RE:How to do vigenere cipher??
How to do a simple caeser cipher?!
i have no idea.
Tony
Posted: Tue Nov 10, 2009 5:51 pm Post subject: RE:How to do vigenere cipher??
Posted: Tue Nov 10, 2009 5:55 pm Post subject: RE:How to do vigenere cipher??
can some one make an example?
Dan
Posted: Tue Nov 10, 2009 6:02 pm Post subject: RE:How to do vigenere cipher??
The wikipedia artical tony linked expilains it rather well but the pesdo code would be somthing like this:
code:
CipherText = ""
For letter x in PlainText
y = (x + Key) mod 26
append y to ChiperText
End
This assumes the letter x is repsented by a system such as A=0, B=1, C=3, .... Z=25. You can do this easly if you give some thought as to how chars are repesented in ASCII.
Note that the value of 'A' in ASCII is 65 and 'B' in ASCII is 66...... 'Z' is 90.
Computer Science CanadaHelp with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
nelsonkkyy
Posted: Tue Nov 10, 2009 6:16 pm Post subject: RE:How to do vigenere cipher??
it does not work/.\
Tony
Posted: Tue Nov 10, 2009 6:29 pm Post subject: RE:How to do vigenere cipher??
Posted: Tue Nov 10, 2009 6:44 pm Post subject: RE:How to do vigenere cipher??
the mod dosen't work
nelsonkkyy
Posted: Tue Nov 10, 2009 6:52 pm Post subject: RE:How to do vigenere cipher??
can someone make a vigenere cipher example for me plz??
nelsonkkyy
Posted: Tue Nov 10, 2009 7:59 pm Post subject: Re: RE:How to do vigenere cipher??
Dan @ Tue Nov 10, 2009 6:02 pm wrote:
The wikipedia artical tony linked expilains it rather well but the pesdo code would be somthing like this:
code:
CipherText = ""
For letter x in PlainText
y = (x + Key) mod 26
append y to ChiperText
End
This assumes the letter x is repsented by a system such as A=0, B=1, C=3, .... Z=25. You can do this easly if you give some thought as to how chars are repesented in ASCII.
Note that the value of 'A' in ASCII is 65 and 'B' in ASCII is 66...... 'Z' is 90.
SO how do i write like"a=0" for each letters
Dan
Posted: Tue Nov 10, 2009 8:23 pm Post subject: RE:How to do vigenere cipher??
Note that this only works for capital letters as lower case letter have diffrent values. If you want your chiper to handel both you will either have to convert them to upper case before encrypting or change how the chiper works to keep the case intack.
Computer Science CanadaHelp with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
nelsonkkyy
Posted: Tue Nov 10, 2009 8:36 pm Post subject: Re: RE:How to do vigenere cipher??
Turing:
var plaintext,key,ciphertext:string
put"Enter a plaintext to encrypt" get plaintext
put"Enter a key word" get key
for i:1..length(plaintext)
ciphertext :=ord(plaintext) -65
put ciphertext
%like that???%
Dan
Posted: Tue Nov 10, 2009 9:23 pm Post subject: RE:How to do vigenere cipher??
Well thats a start, however there are some problems.
First "x := ord(myChar) -65" witch i posted is how to go from ascii code values of capaital letters to A=0, B=1, C=2, ... Z=25 type values. So you still need to use the key on the chipertext.
Also the ord command is used on characters and not strings.
Here is some code to work with:
Turing:
for i:1..length(plaintext)
x :=ord(plaintext(i)) -65 % use key on x here % convert x back to a char % append x to chipertext string endfor
plaintext(i) Should return the character at index i in the string plaintext. So if "Hello World" was input and i was 2, it would be equal to 'e' (if i rember how string indexs in turing work correctly).
ord(plaintext(i)) converts the char from plaintext(i) to an integer (from the ASCII table).
Subtracting it by 65 bring it from A=65, B=66, ... Z=90 to A=0, B=1, ... Z=25.
The result is stroed in x (witch you need to declair some where above the for loop).
Give some thought to it and try to replace the comments with the correct code.
Also i should note that you are inputing key as a string. For this chiper the key is a integer, so you should either input an integer or convert the string to an integer.
Computer Science CanadaHelp with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
nelsonkkyy
Posted: Tue Nov 10, 2009 10:00 pm Post subject: RE:How to do vigenere cipher??
can you send an example for me plz. I still can't do it. my email:nelsonmilk@hotmail.com