Google Answers Logo
View Question
 
Q: Translate-- Caesarian Encryption ( Answered,   0 Comments )
Question  
Subject: Translate-- Caesarian Encryption
Category: Computers > Programming
Asked by: tltbld-ga
List Price: $2.00
Posted: 27 Feb 2003 19:05 PST
Expires: 29 Mar 2003 19:05 PST
Question ID: 168130
I am trying to complete a translation command to translate A file to
Caesarian Encryption in Unix.. thus shifting the alphabetical letters
5 chars over ... ex: A would become F and so on...please help!!

Request for Question Clarification by answerguru-ga on 27 Feb 2003 23:53 PST
Hi there,

What exactly are you asking for here? Are you looking for a
description of how this form of encryption works or the source code to
implement it? Please keep in mind that the type of information you are
looking for should be reflected by the price of your question.

answerguru-ga
Answer  
Subject: Re: Translate-- Caesarian Encryption
Answered By: maniac-ga on 28 Feb 2003 05:01 PST
 
Hello Tltbld,

There are a few ways to do this and I'll provide links to
implementations in Basic, C, and Python for reference. The two primary
ways are
 - do arithmetic on each letter (add 3, if >Z, then subtract 26)
 - use each letter to look up the replacement from a string or array
The following examples show both methods in a variety of programming
languages.

Basic
  http://www.pbcrypto.com/view.php?algorithm=caesar
which converts each character to its numeric value, adds the key, and
converts back into a character. It does not strictly implement the
Ceasar algorithm since it does not limit the range to the alpha
characters but a simple change would fix that.

C
  http://www.free2code.net/tutorials/c/cipher
a tutorial on ciphers with source code for ROT13 (a Ceasar cipher,
fixed at an offset of 13) and a monoaphabetic substitution cipher.
This example shows two ways to implement the Caesar cipher, by
arithmetic on the letters (similar to the Basic example) or by looking
up a value in a reference string.

Python
  http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/142813
this is perhaps the most straight forward version of the three. The
first function (named cipher) gets passed a string and key (# of
characters to shift) and generates the encoded character for all
letters in the range of 'a' to 'z'.

To find this information, a search of
  ceasar cipher source code
was used.

  --Maniac
Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy