Answered step by step
Verified Expert Solution
Link Copied!

Question

...
1 Approved Answer

Alice and Bod have decided to use a symmetric encryption algorithm. They have some assumptions about their messages: - Messages only contain capital letters (

Alice and Bod have decided to use a symmetric encryption algorithm. They have some
assumptions about their messages:
- Messages only contain capital letters (i.e. A to Z)
- The length of their shared key must be greater than or equal to the length of the plaintext
- They assign each letter a number as follows: (A,0),(B,1),(C,2),(D,3),...,(Z,25)
Their algorithm combines the key and the message using modular addition. The numerical values
of corresponding message and key letters are added together, modulo 26. For example, if the plain
text is HELLO and the key is SECRET then the encrypted message is calculated as following:
Since the length of the plaintext is 5, we just need the first 5 letters of the key (i.e.SECRE), then
for each letter, we should add corresponding letters in both the plaintext and the key modulo 26.
Plaintext: H (7) E (4) L (11) L (11) O (14)
Key: S (18) E (4) C (2) R (17) E(4)
Cipher: Z (25) I (8) N(13) C(2) S (18)
a) Write a program in Python, C/C++ or JavaScript to take both the plaintext and the key as
its input, then print out the cipher. Assume the plaintext is your name, for the
key=THISISANEXAMPLEKEYINCOMPUTERSECURITYEXAM what is the
output?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions