Vigenere Cypher Program in CIn this article, we will discuss the Vigenere Cypher Program in C. Introduction:The text can be encrypted and decrypted using the Vigenere cypher algorithm. Caesar cyphers are related to the Vigenere cipher. It is a technique for encrypting alphabetic text. The letter structure of a keyword serves as its basis. Polyalphabetic characters are used in this substitution cypher. It is easy to comprehend and apply this algorithm. This algorithm was first introduced in 1553 by Giovan Battista Bellaso. Algorithm:1. Enter the term and the plaintext. 2. To make the keyword the length of the plaintext, repeat it. 3. Implement modular addition of the repeated keyword and the plaintext when encrypting data. Ci = Pi + Ki(mod m) Where Ci is the cipher text, Pi is the plaintext, Ki is the repeating keyword, and 'm' is the length of the alphabet. 4. Decryption: Perform modular subtraction of key phrases from the cipher text. Pi = Ci - Ki (mod m) 5. Display the encrypted and decrypted message as well. Example:Now, let's take a program to understand how we can use the Vigenere Cypher method in C. Working mechanism:
The user is asked to enter a plaintext message and a key by the program.
The software asks the user to enter a key and a ciphertext.
Output: Some expected output like: 1. Encrypt 2. Decrypt 3. Exit Enter your option: 1 Enter the plaintext (up to 128 characters): Hello World Enter the key (up to 16 characters): KEY Cipher Text: RIJVS UYVJN 1. Encrypt 2. Decrypt 3. Exit Enter your option: 2 Enter the ciphertext: RIJVS UYVJN Enter the key: KEY Deciphered Text: HELLO WORLD 1. Encrypt 2. Decrypt 3. Exit Enter your option: 3 Next Topic# |