Keyword Cipher Program in Java | ISC Computer Science 2024 Practical
1 هزار بار بازدید -
10 ماه پیش
-
Keyword Cipher Program in Java
Keyword Cipher Program in Java | ISC Computer Science 2024 Practical
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
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
10 ماه پیش
در تاریخ 1402/08/13 منتشر شده
است.
1,086
بـار بازدید شده