Home » Cryptography

Vernam Cipher in Cryptography

This article is about an encryption technique: The Vernam cipher. In this article, we will first have a brief introduction regarding this technique and then will look into how the encryption and decryption are performed in it?
Submitted by Monika Sharma, on January 17, 2020

The Vernam cipher is a cipher technique that encrypts the plain text by working on the binary level of the text. Although not widely used due to its simplicity and being more prone to be cracked by any outsider, still this cipher holds much value as it is amongst the firstly developed encryption techniques (like the Caesar cipher).

Now, talking about its characteristics and details, Vernam cipher is a cipher in which we consider both the plain text and the key string in its binary form.

The following key points can be drawn for the Vernam cipher,

  • The key chosen here is a string whose length must be either less or equal to the length of the plain text.
  • It is a type of symmetric-key cryptography.
  • It is a type of poly-alphabetic cipher, being a part of the substitution cipher.

Encryption Process

  • Here, firstly, we convert both our plain text and the key string into its binary form.
  • The key can be either in string form or directly in binary form also.
  • The bits of the key string is repeated again and again until its length becomes equal to that of the plain text.
  • Perform XOR operation between the elements of the plain text with the respective elements of the ley string which hold the same positions.
  • Therefore, the encryption on the plain text to convert it into ciphertext is performed as follows,
        E (Pi , Ki) =  Pi  (XOR)  Ki
    

Decryption Process

The process of decrypting the ciphertext to convert it back into plain text is performed in the same way as the encryption process. Therefore, the formula for decryption of the text under Vernam cipher is as follows,

    D (Ci , Ki) =  Ci (XOR)  Ki

Example Problem

    Given Plain text: 'IF'
    Key: 10100

Convert the given plain text into cipher text...

Solution:

  • Convert the given plain text into its binary form,
        1001001 1000110
    
  • Repeat the key sting until its length becomes equal to that of the plain text,
        1 0 0 1 0 0 1   1 0 0 0 1 1 0
        1 0 1 0 0 1 0   1 0 0 1 0 1 0 
    
  • Tape the elements of the plain text with the respective elements of the ley string which hold the same positions.
    Example for position 1, we encrypt as follows,
    E( 1, 1 )   =  1  XOR  1
                = 0
    
  • Similarly, after performing the encryption for the whole plain text, we get the following results,
        1 0 0 1 0 0 1   1 0 0 0 1 1 0
        1 0 1 0 0 1 0   1 0 0 1 0 1 0 
        -----------------------------
        0 0 1 1 0 1 1   0 0 0 1 1 0 0
    

Note: You can cross-check your answer by applying the decryption process over the ciphertext, and if it comes back to be the same as the plain text, then it means that our answer is correct.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.