Re: It's the Caesar Cipher Message #4 Posted by Ernie Malaga on 24 Nov 2002, 3:18 p.m., in response to message #3 by oevna
oevna:
The central idea in ROT13 is that the text should be encrypted OR decrypted by using the same algorithm, i.e., adding 13. In order to do the same with numbers, you'd have to use ROT5. In any case, ROT13 is a very weak encryption algorithm, too easy to break.
A few years ago I developed a variation of ROT13 which worked by inverting the status of all 8 bits in each character, so that an x'00' became an x'FF'. It mystified those that took a casual look at an encrypted file, simply because it looks like binary data, or hexadecimal gibberish.
The main subroutine's code follows. It's written in RPG IV (for IBM AS/400). I'd love to translate it to HP-41 lingo, but I haven't investigated the matter.
C invert BEGSR
C FOR i = 1 TO 1600
C EVAL char = %SUBST($$text:i:1)
C TESTB '0' char 10
C TESTB '1' char 11
C TESTB '2' char 12
C TESTB '3' char 13
C TESTB '4' char 14
C TESTB '5' char 15
C TESTB '6' char 16
C TESTB '7' char 17
C EVAL char = X'FF'
C 10 BITOFF '0' char
C 11 BITOFF '1' char
C 12 BITOFF '2' char
C 13 BITOFF '3' char
C 14 BITOFF '4' char
C 15 BITOFF '5' char
C 16 BITOFF '6' char
C 17 BITOFF '7' char
C EVAL %SUBST($$text:i:1) = char
C ENDFOR
C ENDSR
-Ernie
|