Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please code in C language 1. Write a program that takes an input string from the user and encrypts the message, or decrypts it, using

Please code in C language

image text in transcribed

1. Write a program that takes an input string from the user and encrypts the message, or decrypts it, using a variable shift cipher: Shift Cypher: creates one substitution alphabet (monoalphabetic) where each letter in the plaintext message is substituted by the letter kh locations later (allowing wraparound; that is, having the letter 'Z' followed by the letter 'A' and the letter 'z' followed by the letter 'a') E(x) + k) mod 26 Dk (x) - (x - k) mod 26 Detailed example below: Plain text: The quick brown fox jumps over the lazy dog Ciphertext 1Uif rvjdl cspxo gpy kvnqt pwfs uif mbaz eph 5 Ymj vznhp gwtbs ktc ozrux tajw ymj qfed itl Znk waoiq hxuct lud pasvy ubkx znk rgfe jum 7Aol xbpjr iyvdu mve qbtwz vcly aol shgf kvn 8 Bpm ycqks jzwev nwf rcuxa wdmz bpm tihg lwo 11Esp bftnv mczhy qzi ufxad zgpc esp wlkj oz 12Ftq cguow ndaiz raj vgybe ahqd ftq xmlk pas 20 Nby kocwe vliqh zir dogjm ipyl nby futs xia 21 Ocz lpdxf wmjri ajs ephkn jqzm ocz gvut yjb 25 Sgd pthbj aqnvm enw itlor nudq sgd kzyx cnf 26 The quick brown fox jumps over the lazy dog a) Implement the following functions char shiftCipher (char inputStr, int k) char *revShiftCipher (char *inputStr, int k) b) Decrypt the following message assuming it uses a shift cipher: fubswrjudsklf dojrulwkpv lqyroyh vxewlwxwlqj rqh wklqj iru dqrwkhu c) What is the maximum number shifts before you could decrypt the message in part b

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