Thread: How to do encryption in C

  1. #31
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by sankarv
    sorry. i could nt figure out the poblem. i was debugging for long time and im vexed. i am getting awkward values in debugging. just i want this encryption logic common for strings,numbers and special characters since all occur in a file.
    pls help...
    What Salem is getting at is make yourself a better code troubleshooter. Don't try and carry the 100Kg backpack all at once. Break it up into smaller and smaller units, THEN work through it line by line, watching your variables as you go.

    Forget about the code that works, and concentrate on what doesn't - in this case, the numbers and other non letter, char's.

    Post up what you find that's not right, and what you've tried to do to correct it.

    I think numbers and other char's need to be treated a little differently than letters, in this program. What do you think?

    Adak

  2. #32
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Make it simple - just encrypt and decrypt a letter, say 'a'.
    Put a printf on every other line in the code, and watch what happens.
    Then do the same for a space ' ', and try to understand the differences.

    Which compiler / debugger do you have?

    > i am getting awkward values in debugging
    So you found a bug perhaps?
    So how about documenting your confusion in a post rather than just moaning that it doesn't work, and hoping someone will post a complete answer.

    Personally, I think it's only a few days since you did the "hello world" program and now you're in way over your head.
    Day 1 - build paper aeroplane
    Day 2 - try and attach jet engines
    Day 3 - post on www.paperplanes.com/forums that plane doesn't work.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #33
    Registered User
    Join Date
    Dec 2010
    Posts
    1
    CAN YOU HELP ME FOR WRITING A PROGRAM IN C ?
    Encrypt the message “I LOVE DISCRETE” by translating the letters into numbers, applying the encryption function given below, and then translating the numbers back into letters. Additionally; find the corresponding decryption function, and apply it to the ciphertext to revert back to the original message

  4. #34
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    You didn't post all the "see below" information.
    You didn't read the forum rules, particularly the one about digging up 4 year old threads.
    Nor the rule about homework.

    Closed - now try again with more effort in a NEW post.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. help needed with edit control & encryption
    By willc0de4food in forum Windows Programming
    Replies: 2
    Last Post: 03-16-2006, 08:21 PM
  3. abt encryption algorithm
    By purIn in forum C Programming
    Replies: 9
    Last Post: 12-22-2003, 10:16 PM
  4. What's wrong with my Stream Cipher Encryption?
    By Davros in forum C++ Programming
    Replies: 3
    Last Post: 04-18-2002, 09:51 PM
  5. File Encryption & Read/Write in Binary Mode
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 06:45 PM