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
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
  • 3
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
1 answer

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
  • 27
  • 5
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
  • 328
  • 1
  • 10
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
  • 328
  • 1
  • 10
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
1
vote
1 answer

Fill Array With repeated String - JAVA

I'm implementing a Vigenere Ciphering and lets say I have a String called key with value for example "KEY" and I want to fill array of char with that string for size of plainText For example I have a plain Text "JAVA IS BEST" the char Array…
1
vote
2 answers

Java Vigenere Cipher

I'am trying to decipher Vigenere_Cipher when i enter BEXR TKGKTRQFARI the output is JAVAPROGRAMMING But i want to put space like JAVA PROGRAMMING. My Code public static String VigenereDecipher(String text) { String keyword = "SECRET"; …
Hunterx01
  • 29
  • 6
1
vote
0 answers

pset2 vigenere help (Segmentation Fault)

#include #include #include #include #include int main(int argc, string argv[]) { string k = argv[1]; if (argc == 2 && isalpha(k)) { printf("plaintext: "); string p =…
1
vote
1 answer

Cs50 Vigenere code gives unexpected output when using the proper ASCII Values

I have written this code for the Vigenere problem in cs50. However it doesn´t work as expected when I print the enciphered letters I use 58 and 90 instead of 65 and 97.(the ASCII values for A and a) Doing so gives me the result I wanted however I…
D J
  • 11
  • 2
1
vote
2 answers

Creating 2D List using for loop in Python3 for vigenere cipher

So, I'm trying to make a program that can encrypt and decrypt vigenere ciphers in python 3. I'm doing this for practice, but I'm really struggling with the creation of a cipher matrix. If you're unfamiliar with vigenere ciphers, here's a helpful…
GarrukApex
  • 153
  • 2
  • 10
1
vote
2 answers

Vigenère table in PHP

I am trying to make a Vigenère table using PHP. My goal is to make a big array with 26 smaller arrays in it like this: $bigarray = [['a'-'z']['b'-'a']...['y'-'x']['z'-'y']]; I'm thinking of making the first array using the range() function, append…
EdKorket
  • 48
  • 10
1
vote
2 answers

Generate Vigenère Cypher table in Python

I've been struggling in creating the vigenere table in python That should be the result: So basically I have the entire alphabet on the first line, and the alphabet shifted by one letter on the second one etc. That's my code so far: class…
Alex
  • 73
  • 7
1
vote
0 answers

vigenere key sees spaces

Writing a Caesar and Vigenere cipher. I have the code working correctly (I think). My concern with the code, where there are spaces in the text. I need the key to pick up, move over the space, and return when there is another character... Ex: $…
1
vote
1 answer

Python Vigenère cipher not working

I've created this code that uses the Vigenère cipher to encrypt a block of text, for some reason it's giving me this weird output import string original_word = raw_input("what text do you want to encrypt ?") one_time_pad = raw_input("How do you…
Zubin JAIN
  • 47
  • 3