I made several posts trying to depend on others concerning this question but what everyone did was neglecting me and putting me down trying to make me do some effort obliging me to think by myself and knowing that if I do so I will find everyone besides me trying to help ...the way I came to is that first I have to write a pipe in the parent process p1 which reads the plaintext and ciphertext containing numbers generated randomly (and is more easier if provided by user) between 0 and 100000000 then sends it throught another pipe after a fork to child process p2, then p2 must contain a function which transforms the decimal numbers in ciphertext and plaintext to binary since the XOR works bitwise ,then sends it throught another pipe after a fork to child process p3, then p3 must contain the function K=P^C which gets the key in binary if we have answer 1 then it is true else it is false , then sends the answer throught another pipe after a fork to child process p4, then p4 must contain a function which transforms the key again to decimal then resends it to P1 which displays the answers from all forks ... is that right ???? but what is a semaphore? and how do I use it in here ? and i think he said 3 trials ? trials for what ? the question is written below here :We are requested to implement a code cracking system. The system will deploy four processes (p1,p2,p3 & p4) to try to guess the password of an encrypted code.
For encryption, we consider that the formula is: C = P XOR K, where
• C = encrypted code
• P = plain text
• K = key
For decryption the formula is: P = C XOR K. So, your program will try to find K using this formula. The XOR operator is ^.
Given an encrypted code C and plain code P your program should deploy three processes to try and find the key used to encrypt the plain code. These three processes will be under the control of process P1.
All processes will send their results to process P1 and process P1 will terminate the three processes and display the encryption key and decrypted text once any of the three processes finds the key.
For simplicity we will consider that we have the original number P stored in a file called plain.txt and the encrypted code is stored in a file called cipher.txt. Consider that only numbers are stored in these files and they have a range between 0 and 100000000.
So we have P and C your program should find the key K. Consider that K is a positive number between 0 and 1000000.