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.

330 questions
-2
votes
2 answers

My program runs but it doesn't output an Encrypted Message

The code I wrote is a Vignere Cipher encryption program that uses a keyword to encrypt a message. I wrote this code and when I finished it I ran it and it did all it was supposed to but output the encrypted message. See my code below, any help is…
-2
votes
1 answer

Vigenere Cipher program in Python using mod 37

I'm trying to write a Vigenere Cipher program in Python using mod 37. I need help figuring out what the issue is. alphabet= "abcdefghijklmnopqrstuvwxyz0123456789 " def Let2Ind(x): return(ord(x)-ord("a")) def Ind2Let(n): …
Cfish
  • 1
  • 1
-2
votes
1 answer

Vigenere Cipher c# with "ñ"

I'm making a program of Vigenere cipher in c # but I'm having a problem i don't have the "Ñ" I would like to encrypt as happens in Vigenere cipher but With the "Ñ" how add the letter "Ñ" to this code? such that both key and s remain this way: a=0…
-2
votes
1 answer

Why does the compiler give an " java.lang.ArrayIndexOutOfBoundsException: x -error? (size depends on input)

I am making a small program to guess the keylength of a vigenere-cipher, with a given length between 5-15, within java. I do this by calculating standard deviations because of the transpositions. But my real question is why I get an out of bound…
-2
votes
3 answers

Why am I getting a warning 'Segmentation fault, core dumped' in C

I am writing a program that encrypts plain text to ciphertext. I am receiving a Segmentation Fault, core dumped error when I go to run my program. Here is my code: #include #include #include #include int…
howdydoody
  • 93
  • 2
  • 17
-2
votes
2 answers

The Vigenere encryption

I have written some code, and the Vigenere encryption is used in it. This is a simple program for encrypting/decrypting any files. #include /* LANGUAGE: C. STANDARD: C89. ABOUT PROGRAM: This is a simple program for encrypting/decrypting…
Andrey Bushman
  • 10,107
  • 12
  • 64
  • 150
-3
votes
1 answer

Vigenere Cipher

i am facing the problem while running the below code designed for vigenere cipher.even after going thoroughly i am not able to debug the problem. it is showing the error:killed by server.please help. /** * * vigenere.c * * Abhishek kumar *…
-3
votes
2 answers

What does "string index out of range" mean in this Vigenere cipher?

#Vigenere Cipher EncryptedMessage="" Mode="" Keywordcount = 0 #sets everything to 0 KeywordTwocount = 0 while Mode != "encrypt" and Mode != "decrypt": Mode = input('Do you want to encrypt or decrypt a message?') Mode = Mode.lower() if Mode…
-3
votes
1 answer

Vigenere cipher in python

Writing a vigenere cipher in python and I've got completely lost in it, anyone fancy giving me a hand and suggesting things that could be improved/make it work correctly? Currently I'm getting all sorts of errors…
bleh
  • 1
  • 2
-3
votes
4 answers

I have no idea why I'm receiving segmentation fault errors

#include #include //stdlib.h is included in cs50.h so I don't need it #include #include #include int main(int argc, string argv[]) // command line input { if(argc != 2) // check if there is only…
iced
  • 17
  • 1
-4
votes
1 answer

reverse engineer equation to convert ciphertext to plaintext

I have the following formula: ciphertext[i] = ((plaintext[i] -'a' + k) % 26) + 'a'; I'm trying to solve for plaintext[i] given ciphertext[i]. I'm using a vigenere cipher. If I convert plain text to cipher text shouldn't there be a way to…
DCR
  • 10,658
  • 7
  • 38
  • 86
-4
votes
1 answer

trouble with the vigenere cipher

print ("") print ("Welcome to Vigenere cipher!") print ("") print ("This program will encrypt then offer you a decryption of your message.") print ("") print ("Start this off with inputting your message you would like to encrypt.") m =…
user4921999
-4
votes
1 answer

Vigenere Cipher Black Hawk Down

I cannot figure out why this thing doesn't scramble correctly. I read some other posts on this cipher and as far as I can tell I'm using the exact same algorithm as they are... The areas commented out are tests I tried to make sure everything was…
Krill
  • 35
  • 5
-5
votes
2 answers

Vigenere Cipher - Not giving letters

I am trying to make the Vigenere cipher in python. I found some code on the internet that I was going to work around as it was hard. When I run this code: plaintext = "HELLO WORLD" keyword = "KEYKEYKEYKEY" encoded = "" for c in…
-6
votes
2 answers

Vigenere Cipher logic error

#include #include #include #include int main(int argc, string argv[]){ int k,j,i=0,ch,pos; bool apha=true; string in = GetString(); int num = strlen(in); for(int z=0;z
1 2 3
21
22