Assignment 3 in High performance Computing (Parrallel processing), Encrypt a message using Caesar Cipher.
You are required to take a message from a file and encrypt the message using caesar cipher and store the output in a new file.
The encryption can be represented using modular arithmetic by first transforming the letters into
numbers, according to the scheme, A = 0, B = 1,…, Z = 25.
For example :
Encryption of a letter x by
a shift n can be described mathematically as:
Any other character outside the range from A to Z (or a to z) is transferred to the output file as it is.
Input: filename and key/shift value.
Output: new file that contains the encrypted message.
First case: a messege length is divisible by number of processes, in myfile.txt I have written a string of 20 characters
so 20/4 = 5 and 20%4=0 ... then each process will handle 5 charachters
Second case: a messege length is not divisible by number of processes, in myfile.txt I have written a string of 20 characters
but used 3 processes, 20%3=2... so each process will take 6 characters and the last 2 characters are handeled by master at the end