Keyword Cipher
Keyword Cipher
Keyword Cipher
Encryption:
The first line of input contains the keyword which you wish to enter. The second line of
input contains the string which you have to encrypt.
Plaintext: 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
Encrypted: K R Y P T O S A B C D E F G H I J L M N Q U V W X Z
With KRYPTOS as the keyword, all As become Ks, all Bs becoming Rs, and so on.
Encrypting the message “knowledge is power” using the keyword “Kryptos”:
Encrypting the message: Knowledge is Power
Encoded message: IlmWjbaEb GQ NmWbp
Example2
Input :
Keyword : secret
Message : Zombie Here
Output :
Ciphered String : ZLJEFT DTOT
Take the first example, we used "secret" keyword there.
Plain Text : 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
When "secret" keyword is used, the new encrypting text becomes :
Encrypting : S E C R T A B D F G H I J K L M N O P Q U V W X Y Z
This means 'A' means 'S', 'B' means 'E' and 'C' means 'C' and so on.
Lets encode the given message "Zombie Here"
ZOMBIE HERE becomes ZLJEFT DTO
Introduction
Encryption
“HELLO WORLD”
Next, we have to choose a keyword. The keyword should not have any
repeated alphabets. Let the keyword be
“DRAGON”
Next, we map each alphabet in plain text to the alphabet in the ciphertext. The
starting N alphabets of plain text are mapped to the alphabet of the keyword
where N is the length of the keyword.
To fill the rest of the alphabets in the ciphertext, we use the remaining
alphabets in chronological order. We skip over those alphabets that are
already present in the ciphertext. See the figure shown below