.

Monday, April 1, 2019

Vigenère Cipher C Program

Vigenre Cipher C Program bring out a C program to implement a Vigenre solve. You may use whatever IDE you wish but the program must(prenominal) be compile with the standard gcc compiler. Your program should give the user the survival to either encrypt or decipher a message. The user should be prompted to go into the passphrase to be entered and the constituteword to be used in the slide fastener. The output should be school school school textual matterbookual matter printed to stdout. Comments should be used to explain the rationale behind the design of your code. You must also provide a critical analysis as to the validity of the Vigenre count on and provide a recommendation as to whether or non it would be it would be sufficient for use in communications amongst colleagues within a non-technical environment.C Programme/* Vigener Ciper*//*This is the program to compute and to decode the text using the Vigener ciper method*//* User has to choose the option either to Encrypt or to Decrypt *//*The user has to enter the text to be Encrypted and the Key to*//*The user has to enter the Encrypted Text and Key to Decrypt the text*/includeincludemain()int select// variable declairationint i,j coal passphrase256 char underlyingword33int jimmywhile(1)// infinite loopprintf(n1.Encrypt n)// Display options for the userprintf(2.Decryptn)// Encrypt or Decryptscanf(%d,select)// read the option selectedif (select == 1)printf(Please Enter Message to be encryptedn)//text to be encryptedscanf(%s,passphrase)printf(Please Enter keywordn) // key wordscanf(%s,keyword)for(i=0,j=0iif(j=strlen(keyword))// buy up the key wordj=0value = (((passphrasei)-97)+((keywordj)-97)) //logic (passphrase+key)%26printf(%c, 97+ (value %26)) // display Encrypted textelse if (select == 2)printf(Please Enter Encrypted Message to be Decryptedn) //text to be decryptedscanf(%s,passphrase)printf(Please Enter keyn)//keyscanf(%s,keyword)for(i=0,j=0iif(j=strlen(keyword))j=0// repeate the keyvalue = ((passphrasei)-96)-(keywordj-96) //logic (passphrase-key)%26if( value value = value * -1 //make the value positiveprintf(%c,97 + (value % 26)) // display dencrypted messageelseprintf(Please Choose a correct optionn)Introduction The c-program gives the user to choose either to encrypt or to decrypt a message. The user will be prompted to enter the passphrase to be entered and the keyword to be used in the nobody.Vigenere nonexistence is a form of polyalphabetic permutation cipher which is used for encrypting a plain text. Vigenere cipher can be explained by Caesar cipher method of encoding. In a Caesar cipher encryption method, every earn of the plain text is shifted to some number of places where as in vigenere cipher every earn is shifted with different shift values. mode of Encrypting and Decrypting The logic to obtain the cipher text by vigener cipher is by modular addition of plaintext and repeating keyword.The formula for the encryption is as followsC(i) = T(i) + K(i) (mod 26)C(i) i-th letter of the cipher textT(i) i- th letter of the plain textK(i) i-th letter of keyword (Key word will be repeated at its end)Similarly, the logic to decrypt the message is by modular subtraction of Encrypted text and keywordThe formula for the decoding isT(i) = C(i) K(i) (mod 26)C(i) i-th letter of the cipher textT(i) i- th letter of the plain textK(i) i-th letter of keyword (Key word will be repeated at its end)The descend of the c- program is explained by the bellow string upchartFlow chart for the C-program 1. encryption Flow chart for Decryption FunctionRobustness of the vigenere cipherWhen the Vigener cipher was first invented and came into use, it was difficult to break as it uses 26 different cipher alphabet. Vigenere cipher is a polyalphabetic cipher and these kinds of ciphers are difficult to decipher because of their immunity to letter frequency analysis and the same text will not be encrypted with same key each time. In the year 1854 a British cryptographer Charles Babbage found the method to decipher the message.The vulnerability for vigenere cipher is repetition of keyWhen a word in plain text repeats it gives the hint to guess the length of the keyOnce the length of the key is found it is easy to crack the vigenere cipherThe above example illustrates how the vigener cipher can be cracked. The plain text used in this is mathsematics is short for mathematics and keyword used is key. Since the plain text contains the word math twice, cipher text also contains the same encrypted text WERR twice with 15 letters apart. Now it can be guessed that keyword must be a factor of 15. 1,3,5,15 are the factors, if it is 1 then it is simple caesar cipher , key word cant be of 15 letter in this case, among 3 and 5 it can be found easily by closely analyzing the ciphertext.RecommendationConsidering the colleges within the non-technical environment Vigenere cipher can be recommended because,As the vigener cipher is difficult to break since it uses 26 different cipher alphabets.The method of encryption is difficult to understand by non-technical people.Without the key, it is difficult to decrypt the messageConclusionVigener cipher is implemented by using the c-program and the flow of the program is explained with the help of flow chart. Vigener cipher is critically analyzed and its robustness is explained. Recommendations are made on use of this method for the communication between colleges in non-technical environment. Referencehttp//crypto.interactive-maths.com/kasiski-analysis-breaking-the-code.html

No comments:

Post a Comment