-
C program for Ceaser Cipher method
can anyone send me C program for Caesar Cipher model?
Thanks a lot in advance
-
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.
-
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
-
Replies: 1
Last Post: 02-18-2007, 07:43 PM
-
By sedricbenson@ho in forum C++
Replies: 2
Last Post: 11-07-2006, 08:18 AM
-
By sedricbenson@ho in forum C++
Replies: 2
Last Post: 11-07-2006, 07:58 AM
-
By mheasen in forum Architecture and Design
Replies: 0
Last Post: 03-20-2002, 09:24 AM
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks