Question
Part 1 Data Encryption Data Encryption is the process of transforming data, using a cipher, to make it unreadable to anyone except those possessing special
Part 1 Data Encryption
Data Encryption is the process of transforming data, using a cipher, to make it unreadable to anyone except those possessing special knowledge. In this problem you will implement a simple encryption technique on data that comprises of non-negative integers that have at least six digits with no leading zeroes. In order to encrypt the number the following functions are to be implemented: void input(int *num); int add4(int num); int shift(int num); void printOutput(int encryptNum, int originalNum); The function input is used to read a positive integer having at least six digits and store it in the variable num. All leading zeroes in the input are neglected and are not counted as valid digits. The function will continue requesting for a number until a valid input is provided by the user. A sample run of the function is shown below with data entered by the user displayed using bold font.
Please enter an integer greater than 99999: 2348
Please enter an integer greater than 99999: 012345
Please enter an integer greater than 99999: 102345
The functions add4 and shift are used to encrypt the number. First, modify the value of each digit of num by adding 4 to the digit. The function add4 modies the value of each digit of num by adding 4 to each digit,and returns the modied number. Due to addition,if the value of any digit is greater than 9 then subtract 10 from the number so that each digit ranges between 0 and 9. For example, if num is 345678 then add4 should return 789012. Note that the number of digits of the modied number returned by add4 can be less than the number of digits in num. For example, if num is 665325, then add4 returns 009769, which is really 9769. The input (num) of the function shift is the modied number(output of the function add4). The function shift shifts the position of each digit to the left by one place. The most significant digit becomes the least signicant digit.
For example,if the input (num)is 567890 then the output of the function shift is 678905. The modied value is returned by shift and is the nal encrypted number. Similar to add4 function, the number of digits returned by shift can be less than the number of digits in num (input to function shift). For example, if num is 107982, then the encrypted number is 79821. The function printOutput prints the original number (originalNum) and the encrypted number (encryptNum). Refer to the examples below for the output format. You are allowed to use the math.h functions in your solution. Remember to add -lm to your gcc command line. Shown below are example runs of the program with data entered by the user displayed using bold font. Given the same user input, your output should match the output exactly, including all punctuation. Any variation from this will result in loss of marks. Example 1: Please enter an integer greater than 99999: 4569012
Develop the code in C programming please
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started