Questions tagged [vigenere]

Vigenère cipher is an encryption algorithm developed in 1553 and was considered uncrackable until the middle of the 19th century.

Application:

In order to encrypt text, you need to choose a word, W, and the encryption table.

Now, you encrypt the mth letter in the text you want to encrypt using a letter from the word W that was chosen before according to the following formula:

Em = L(m % n)

where:
m — the serial number of the letter n the text
Em — the letter for the m letter in the text
n — the length of w
L — the letter in w in the specified index.

Now, in the encryption table you go to (Em,Tm) (Tm is the m letter you encrypt), and write the letter that's written there, instead of the original letter.

The encryption table

 |a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|
------------------------------------------------------
a|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|
------------------------------------------------------
b|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|
------------------------------------------------------
c|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|
------------------------------------------------------
d|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|c|
------------------------------------------------------
e|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|c|d|
------------------------------------------------------
f|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|c|d|e|
------------------------------------------------------
g|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|c|d|e|f|
------------------------------------------------------
h|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|c|d|e|f|g|
------------------------------------------------------
i|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|c|d|e|f|g|h|
------------------------------------------------------
j|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|c|d|e|f|g|h|i|
------------------------------------------------------
k|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|c|d|e|f|g|h|i|j|
------------------------------------------------------
l|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|c|d|e|f|g|h|i|j|k|
------------------------------------------------------
m|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|c|d|e|f|g|h|i|j|k|l|
------------------------------------------------------
n|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|c|d|e|f|g|h|i|j|k|l|m|
------------------------------------------------------
o|o|p|q|r|s|t|u|v|w|x|y|z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|
------------------------------------------------------
p|p|q|r|s|t|u|v|w|x|y|z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|
------------------------------------------------------
q|q|r|s|t|u|v|w|x|y|z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|
------------------------------------------------------
r|r|s|t|u|v|w|x|y|z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|
------------------------------------------------------
s|s|t|u|v|w|x|y|z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|
------------------------------------------------------
t|t|u|v|w|x|y|z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|
------------------------------------------------------
u|u|v|w|x|y|z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|
------------------------------------------------------
v|v|w|x|y|z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|
------------------------------------------------------
w|w|x|y|z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|
------------------------------------------------------
x|x|y|z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|
------------------------------------------------------
y|y|z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|
------------------------------------------------------
z|z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|

More information at Wikipedia under Vigenère cipher.

348 questions
0
votes
1 answer

C: Segmentation error

I'm implementing in c the vigenère algorithme. Unfortunately when testing the program I'm experiencing a segmentation error. I'm compiling with clang on mac. How could I avoid that error ? Source Code: #include #include #include…
Bellum
  • 175
  • 1
  • 10
0
votes
1 answer

What is wrong with my CS50 Vigenere cipher program?

I have been working on this Vigenere cipher for about 8 hours straight. Can you please help me? I think that main problem is around the algorithm - I don't know how to utilize the keylength (I know I need to get the mod of it somehow). #include…
user3342048
  • 55
  • 1
  • 10
0
votes
1 answer

Vigenère cipher in C, how to shift keyword only on alpha chars

I'm trying to make a Vigenère encryption code for my problem set of the week and I'm almost done. I have a little problem, I can't make the keyword char shift only on alphabetical chars this is my code and I can't track the problem. GetString() is…
Nick
  • 393
  • 2
  • 4
  • 10
0
votes
1 answer

Vigenere Cipher - Segmentation Fault

I am trying to create a vigenere cipher and I am getting a segmentation fault. I am fairly new, and it would be highly appreciated if someone could help. Thank you in advance. // Mukul Patel February 26, 2014 int my_key(string key) { int…
itzmurd4
  • 663
  • 10
  • 25
0
votes
1 answer

Python Vigenere Code repeating error

We have to do a vigenere cipher for a project, and my code just keeps repeating itself. Like it wont run the encrypt or decrypt. here is my code. like this is what it does for an example.. "Hey There user! whats your message??hi How many letters…
0
votes
2 answers

Vinegere Cipher with C++ having an issue with output

I am having some issues trying to get my code to work. It prints ALMOST the right data but maybe it isn't looping correctly? I don't think it repeats the key through the alphabet. It's all lowercase and doesn't exceed 26. void vigenereEncrypt(…
0
votes
2 answers

poly alphabet encryption using vigenere table(java)

I have encrypted text using vigenere table in this program, but on compilation it is giving this exceptio: Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - not a statement at…
user3263216
0
votes
1 answer

Modified Vigenere Cipher in python - Alphabet

This is what I have to do: Write a script in Python that is an implementation of a version of the Vigenere cipher for English text. Your script should distinguish lowercase and uppercase letters (i.e., the encryption key and the plaintext are…
Marcos Guimaraes
  • 1,243
  • 4
  • 27
  • 50
0
votes
1 answer

Vigenère cipher implementation outputs an unexpected number

I have this Vigenère cipher code that works, but it spits out a number one on the first encryption when I put "Attack at Dawn" (POTTER). It comes out as 1inuhc Qi Xubf. What is causing this? public class vigenere { public static void…
Gxfire
  • 27
  • 2
0
votes
0 answers

Can't loop through a string for a second time

I'm trying to implement the Vigenere Cipher, but I have a problem while trying to loop trough the key. First, all the little functions, although, I don't think the problem is there. #include #include #include #include…
smeshko
  • 1,184
  • 13
  • 27
0
votes
1 answer

vigenere cipher error when trying to encrypt/decrypt

I am getting this error when I run my program: Traceback (most recent call last): File "C:/Users/####/PycharmProjects/hw5/Homework5_Cepero.py", line 112, in decrypt() File "C:/Users/####/PycharmProjects/hw5/Homework5_Cepero.py", line 78, in…
user2998626
0
votes
2 answers

Java vigenere cipher performance issues

I have made a vigenere encryption/decryption program which seems to work as I intended, however running my encryption/decryption on a very large text file (500,000 characters aprox) takes 2-4minutes. I have looked through my code and cannot see what…
gdm181
  • 3
  • 3
0
votes
1 answer

How to combine Vigenère cipher with fibonacci

I have Vigenère cipher java code, and it's running well, but i want to modify this code with fibonacci formula, so the encryption result like a one time pad method.. here is the code : public class Coba { public static void main(String[] args)…
0
votes
1 answer

splitting up cipher text into substrings (vigenere cipher)

I'm trying to implement an algorithm which will guess at a likely key length of a keyword of a vigenere cipher. I'm going about the steps of finding the index of coincidence for each possible key length, but I can't figure out a way to split the…
docaholic
  • 613
  • 9
  • 29
0
votes
3 answers

C - Array of strings to an array of char

In C, I need to take a single string argument from argv [] and put it into another array so that I can iterate over the chars. How do I do this? (this is to implement a Veginere Cypher FYI)
JDillon522
  • 19,046
  • 15
  • 47
  • 81