Thread: am i thinking logically ?

  1. #1
    Registered User
    Join Date
    Dec 2012
    Posts
    15

    Question am i thinking logically ?

    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.

  2. #2
    Registered User
    Join Date
    Dec 2012
    Posts
    307
    1) we didnt neglect you, you recieved MANY responses to your question, to which you had a minimul response to give us to go on.
    2) we are here to HELP YOU FIX YOUR CODE, no fix what you found on the net that someone else did, and not to do it all for you
    3) each post you did not put any of YOUR code for us to see problems
    4) REPOSTING a new thread will just get you ignored for not following basic rules

    i miss anything?

  3. #3
    Registered User
    Join Date
    Dec 2012
    Posts
    15
    dear sir I posted the logic I am thinking of and I want someone to tell me if it is write and where is the mistake so i can try to start working with the code. and I removed the "urgent help" thing because now I am convinced that no one will help me if I don't try to help myself.
    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 ?

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    The "trial" refers to the 3 child processes which will each try to decode the cipher text.

    The negativity you ran into is caused by lots of students who want the code written for them, while doing very little themselves. After a long time, we have become quite negative about that.

    On the positive side, if you look past the negative comments, you know several problems with the code you posted have been mentioned, and should be fixed, before anything else.

    There is a priority to writing a program:

    1) You have to have code that will compile. Nothing runs or can be tested for it's logic, until the compile is working, at least.

    That's where you are stopped. You need to get AT LEAST main() compiling, and then you can build up the other functions, one by one.

    Work on that. If you have a specific question about it, ask away - but show that you are working on getting a basic program for this, that will compile.

  5. #5
    Registered User
    Join Date
    Dec 2012
    Posts
    15
    thanks sir i will post my code so soon, no matter if i passed the course or not , but at least i will ensure that i learned something myself but trust me i will pass and when i get my program it will be working and i will try my best to post a code which works properly trying to do it myself for no help so i may deserve to be a true programmer and to deserve being here

  6. #6
    Registered User
    Join Date
    Dec 2012
    Posts
    15
    by da way thanks for advices sir/s

  7. #7
    Registered User
    Join Date
    Dec 2012
    Posts
    307
    Yes tiger, exactly what ADAK said, which is why my responses, nothing personal

    and seeing that you posted your post on other forums at the same time (cprogramming.com, devshed.com)

    not to mention there they are telling you almost the same thing as we are here, it made me question if you were doing it, or trying to find someone to do it for you.

    -cross


    honestly i would like to see it when it is done, mostly because i like crypto, ESPECIALLY salted!
    Last edited by Crossfire; 12-27-2012 at 07:38 PM.

  8. #8
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    There's no point in asking us if you're thinking logically, when we can see that you have the slightest clue what you're talking about anyway, and don't appear to have the skills to write anything beyond a "hello world" program.

    You know, you've had at least a day within which you could have looked for some online tutorials and learnt at least: If statements, loops, functions, switch statements, and some basic I/O by now. Had you actually done that, then you might stand a chance of completing some of your assignment and we might consider helping you further.

    A good quote I've seen before on the internet: "If I'm given six hours to cut down a tree, then I spend four hours sharpening my axe".
    And in case you didn't get it, "sharping your axe" in this instance refers to learning to program.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  9. #9
    Registered User
    Join Date
    Dec 2012
    Posts
    307
    Nah, tigerfady has been too busy multiple posting other forums online with the same cut and paste garbage she copied from a different forum from 2008!!!

    atleast on devshed, she is up to i think 4 posts since 23rd dec, where they are telling her the same thing we are....

    instead of learning it.

    oh and some posts it is her friend (still) and other it is her code!!!!


    I love when people WANT to learn, hate it when they think learning means someone else is going to do it for you.

    sad to say, but i am done trying to help her, there is no point to it anymore.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Logically, what's wrong?
    By tmac619619 in forum C Programming
    Replies: 5
    Last Post: 11-13-2012, 08:36 PM
  2. too much thinking?
    By willc0de4food in forum Windows Programming
    Replies: 9
    Last Post: 10-03-2006, 05:34 AM
  3. Is this piece of code logically correct???
    By pritin in forum C++ Programming
    Replies: 13
    Last Post: 09-02-2005, 06:33 AM
  4. need help to logically lay out program
    By Led Zeppelin in forum C Programming
    Replies: 3
    Last Post: 04-07-2002, 10:11 PM
  5. I know you've been thinking about this...
    By Aran in forum A Brief History of Cprogramming.com
    Replies: 43
    Last Post: 11-08-2001, 04:13 PM