Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please explain line by line thanks 2. Transposition Cipher (encrypt.c): A very simple transposition cipher encrypt(s) can be described by the following rule: If the

image text in transcribed

please explain line by line thanks

2. Transposition Cipher (encrypt.c): A very simple transposition cipher encrypt(s) can be described by the following rule: If the length of Sis 1 or 2, then encrypt(S) is S. If S is a string of N characters 51 52...Sn and k=[N/2), then enc(S)=encrypt(skSk-1...251)+encrypt(SNSN-1...Sk+1) where + indicates string concatenation. For example, encrypt("OK")="OK" and encrypt("12345678")="34127856". Write a program to implement this cipher, given an arbitrary text string from keyboard, up to 8192 characters. It's better to write a separate encryption function, similar to the following: char* encrypt(char *string, size_t length) { // you fill this out } Input Format: an arbitrary string (with the length up to 8192 characters). Sample Input: Test early and often! Output Format Line 1: One integer: the total number of characters in the string. Line 2: The enciphered string Sample Output: 21 aeyrlet sttflenn aod Implementation hint: it is obvious that encrypt() function should be a recursive function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Relational Database Technology

Authors: Suad Alagic

1st Edition

354096276X, 978-3540962762

More Books

Students also viewed these Databases questions