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
1
vote
1 answer

vigenere encryption algorithm in c with OpenCL does not work as expected

I am trying to make vigenere encryption algorithm in c with OpenCL, i do not have experience in OpenCL. I am using mac os ( so I am running OpenCL 1.2 or 1.1 ) and building the program with Makefile. The file is compiled but the output is not what i…
1
vote
1 answer

Understanding Vigenere cipher in Haskell

I'm having trouble understanding what's exactly going on in the code below. Specifically the recursive function call and "ks++[k]" as well as the chr $ 65. I'm assuming the former is used for recursively iterating through the list, but if someone…
user2602540
  • 27
  • 2
  • 8
1
vote
2 answers

How to check if string is nonsense or set of english words

I am trying to crack Vigenère cipher from school homework by brute-force and I want to write my own script for it, because I have no information about KEY. Is there any tool what can check how much real english words is included in input…
Baterka
  • 3,075
  • 5
  • 31
  • 60
1
vote
1 answer

CS50 Vigenere: wrong loop although SEEMS logical?

I'm a complete newbie trying desperately hard with this pset for the past month. At best I've got the following but this isn't working. I think my shift function is ok, and I know at the moment it's written to print integers at the end, but even…
12082019
  • 11
  • 1
1
vote
1 answer

UndefinedBehaviorSanitiser Issue - CS50 Vigenere

I am working on Vigenere (CS50) and keep getting an "UndefinedBehaviorSanitiser SEGV on Unknown Address" when I run my program with any argument that passes the initial screening. I have read about this issue but cannot find the solution. I cut my…
Remitto
  • 53
  • 10
1
vote
1 answer

Vigenere cipher in Python not working for uppercase/lowercase letter conversion

As part of the CS50 Harvard programming course, which I'm currently attending, I'm doing an exercise called "Vigenere". The Cipher of Vigenere is supposed to have a key as input, for example "abcd". This will encode any plaintext, according to each…
AltijdGoed
  • 55
  • 6
1
vote
1 answer

Python Vigenere Cipher Encrypt method not encrypting properly

The encrypt method in my program is not encrypting correctly. I thought I figured out why using debug mode; it's because it reads the spaces between words as something it has to encrypt. So I tried typing a message without spaces but it still didn't…
Chey
  • 35
  • 4
1
vote
0 answers

How to fix this key generator?

I'm doing a vigenere encrypting in console. First I did the generation of random position in an alphabet of 37 characters. By the way, I'm using visual studio. I tried with some other messages and keys that my classmates gave me and my code worked.…
1
vote
2 answers

Vigenere Cipher Key not working as expected

I have constructed a Vigenere cipher function that works reasonably well, except for the fact that it does not pass the coding test that I'm required to run it through. This is due to the fact that I'm using the ordinal values, while the test is…
1
vote
2 answers

How to get 'isalpha' to iterate through each character of string?

I am having trouble figuring out how to check each character in the keyword (argv[1]). I know I am probably missing something super obvious. :( I have tried saving the string to an array, declaring a new int, but still same problem. //check to make…
alexas
  • 11
  • 4
1
vote
1 answer

autokey vigenere decryption in c#

This is my code to decrypt autokey vigenere cipher algorithm string cipherText = "zicvtwqngkzeiigasxstslvvwla"; string key = "deceptive"; key = key.ToLower(); cipherText = cipherText.ToLower(); int klength = key.Length; int kslength =…
1
vote
3 answers

Vigenère cipher in JavaScript showing or � characters

I made the Vigenère cipher in JavaScript. if I run my Code in Firefox I'm getting the follow output: �QZ4Sm0]m in Google Chrome it looks like this QZ4Sm0]m How can I avoid those symbols or how can I make them visible? What am I doing…
saltea
  • 37
  • 6
1
vote
0 answers

Vigenere Cypher - Code is not working as I expect

I'm trying to figure out why my code is not iterating correctly on z. I would like to iterate every 1 z, but it seems like it's a bit random. Does anyone have any suggestions on how I might do this? If there anything else I'm doing wrong, please let…
QMan5
  • 713
  • 1
  • 4
  • 20
1
vote
1 answer

Vigenere Cipher - How to ignore Spaces in the plain text (in C)?

Bolded is where I am trying to have the program ignore spaces in plain text when it is outputted. I'm confused on how to do this. When I run the program, it does not ignore the spaces. Instead, it is ran as if the bolded else if statement is not…
QMan5
  • 713
  • 1
  • 4
  • 20
1
vote
1 answer

How do I get alphabet from the user

I have a trouble with this. I writing a code for the "vigenere cipher". I have text and key. But i want to get alphabet from the user. what the user wants etc:"abcdfgh" or "sdgfjdgkfdsgs" just what the user wants. So but i can't do it. How do I get…
M.Bugra
  • 11
  • 2