Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reverse the Caesar Cipher in Excel 2010

Status
Not open for further replies.

luxvivens

Technical User
May 20, 2010
27
CA
Using a formula (see below) identified in the Crystal Reports section of this site, I used that cipher to disguise surgeon name when I upload data to an outside vendor.

Later on, I am able to download all the data sent to the vendor and save it in a CSV for subsequent review. However, now I wish to know the actual name of the surgeon in this file. So my question is, is it possible to reverse the cipher for surgeon name in Excel 2010 so that it appears as the correct name? If yes, any ideas how to do this.

The cipher adds 5 characters to each letter. For example “DOE” becomes “ITJ”. So, if I have ITJ in cell A1, how does one turn it back to Doe. Here is the formula as used in the Crystal Reports 10 if that is helpful:

//The Caesar cipher
//The input string to encrypt
Local StringVar inString :=split({pcmProcedure.mdName} , ",")[1];
Local NumberVar shift := 5;
Local StringVar outString := "";
Local NumberVar i;
For i := 1 To Length(inString) Do
(
Local StringVar inC := inString ;
Local StringVar outC;
Local BooleanVar isChar :=
LowerCase(inC) In "a" To "z";
Local BooleanVar isUCaseChar :=
isChar And (UpperCase (inC) = inC);
inC := LCase(inC);
If isChar Then
(
Local NumberVar offset :=
(Asc(inC) + shift - Asc("a")) Mod
(Asc("z") - Asc("a") + 1);
outC := Chr(offset + Asc("a"));
If isUCaseChar Then outC := UpperCase(outC)
)
Else
outC := inC;
outString := outString + outC
);
outString
 
You seem to keep misunderstanding. And it is why we are at odds on this.

1) They do not say that the next number generated by a pseudo random number generator doesn't depend on the generator's current state. What they state (in a number of ways) is that internal state must not be revealed or be able to be derived from the output.

2) As I am sure that you are aware there is a significant difference between a RNG and a PRNG in relation to repeatability. The extract from the NIST document I provided was purely related to the basic criteria by which random number generation (pseudo or not) be considered random, and not its application to any specific encryption/decryption method. (Having said that, I should point out that such techniques as public-key encryption do not require the ability to generate the same random number again, and so could quite happily - if perhaps somewhat arduously - be based off a number generated by dice.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top