Keyword Cipher Program in Java
Keyword Cipher Program in Java
Keyword cipher is a form of encryption technique. A keyword is used as the key, and it determines the letter matching the cipher alphabet to the plain alphabet. Repeats of letters in the word are removed, then the cipher alphabet is generated with the keyword matching to A, B, C, etc. until the keyword is used up, whereupon the rest of the cipher text letters are used in alphabetical order, excluding those already used in the key.
Example:
Encrypting the message: KNOWLEDGE IS POWER when,
Keyword is KRYPTOS
Decoded message: DGHVETPST BM IHVTL
Write a program to accept a Coded text in upper case and a Keyword. Using the above technique decrypt the text and display.
Note: All the messages are encoded in uppercase. Whitespace, special characters, and numbers remains unchanged.
Example 1
INPUT:
ENTER KEYWORD: SECRET
ENTER TEXT TO BE DECODED: ZLJEFT DTOT
OUTPUT:
DECODED TEXT: ZOMBIE HERE
Example 2
INPUT:
ENTER KEYWORD: STAR WARS
ENTER TEXT TO BE DECODED: SPPSAG SP RSVJ
OUTPUT:
DECODED TEXT: ATTACK AT DAWN
Example 3
INPUT:
ENTER KEYWORD: PLAYERS
ENTER TEXT TO BE DECODED: Haln de yolk
OUTPUT:
INVALID TEXT
Other Videos By Robin Sir
2023-12-07 | Matrix Transpose in Java | ISC Computer Science 2023 Paper 1 |
2023-12-02 | Stack Data Structure | ISC Computer Science |
2023-11-27 | Computational Complexity | ISC Class 12 Computer Science |
2023-11-23 | KMap Solution (ISC 2023 Paper 1) |
2023-11-16 | Dudeney Number Java Program (ISC Theory Paper 2023) |
2023-11-15 | KMap Solution (ISC Sample Paper 2024) |
2023-11-14 | Reverse a Number using Recursion in Java |
2023-11-13 | Lecture 8 String Manipulation in Python |
2023-11-08 | Binary Tree (Recursive Data Structure) |
2023-11-06 | Vowels & Consonants Bar Graph Program in Java |
2023-11-04 | Keyword Cipher Program in Java |
2023-11-02 | Lecture 7 Loops in Python |
2023-10-31 | Date Program in Java |
2023-10-28 | Lucky Numbers in Java |
2023-10-26 | Rotate Matrix 270 Degrees Anti-clockwise in Java |
2023-10-24 | The elif Keyword in Python |
2023-10-24 | Vampire Number in Java |
2023-10-18 | Doubly Markov Matrix in Java |
2023-10-16 | Lecture 5 The If Statement in Python |
2023-10-14 | Snowball String in Java |
2023-10-12 | Hamming Number in Java |