DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2008

    C program for Ceaser Cipher method

    can anyone send me C program for Caesar Cipher model?

    Thanks a lot in advance

  2. #2
    Join Date
    Dec 2003
    read the policy on homework and such.

    This one is ultra simple, however, so I will get you started. The Caesar Cipher just shifts the same amount each time. Like, A becomes B, B becomes C, etc. if you shifted by 1 each time. Meanwhile the modulus operator, %, you should understand what this operator does, it will help.

    so all you really need is to iterate over each character and shift it with a modulo.

    For example:
    shift = 3;
    for(x = 0; x < all_the_characters; x++)
    astring[x] = (astring[x]+shift) % 256; ///this one just wraps the ascii table. You can also use % to wrap within the printable characters if you prefer it.

    Note that this is very, very poor encryption: a 10 year old can break the code in about 30 seconds. Consider something at least moderately difficult to solve, such as xor each byte with a random number from a known random number sequence.
    Last edited by jonnin; 02-25-2011 at 10:19 AM.

  3. #3
    Join Date
    Feb 2008

    How to include space in Ceaser Cipher

    Now I made Ceaser Cipher program for input DEVX
    but my program do not run if input is DEVX FORUM, how to include space in ceaser cipher

    Thanks a lot in advance for ur replies

Similar Threads

  1. help, dont know why program is too slow
    By bob2000 in forum Java
    Replies: 1
    Last Post: 02-18-2007, 07:43 PM
  2. Help with Server program
    By sedricbenson@ho in forum C++
    Replies: 2
    Last Post: 11-07-2006, 08:18 AM
  3. Connecting to a Server Program HELP
    By sedricbenson@ho in forum C++
    Replies: 2
    Last Post: 11-07-2006, 07:58 AM
  4. problem in program in c++
    By mheasen in forum Architecture and Design
    Replies: 0
    Last Post: 03-20-2002, 09:24 AM
  5. depricated method needs changing
    By Alan Shiers in forum Java
    Replies: 0
    Last Post: 03-15-2002, 12:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center