ROT 13 encryption has the property that you can use the same algorithm to crypt and encrypt:
>> rot-13 "Rebol"
== "Eroby"
>> rot-13 "Eroby"
== "Rebol"
Here is the source code:
REBOL [
Title: "Rot-13"
Date: 21-Oct-1999
Version: 1.0.1
File: %rot-13.r
Author: "Allen Kamp"
Usage: {To encode >> rot-13 "This is a test" == "Guvf vf n grfg"
To decode, just use rot-13 again >> rot-13 "Guvf vf n grfg" == "This is a test"
}
Purpose: "To Encode and Decode Rot-13 strings"
Email: allenk@powerup.com.au
Notes: {
Rotates Roman alphabet chars by 13 places. Case is preserved.
Used in Newsgroups to prevent accidental reading of content.
}
]
rot-13: func [
{Converts a string to or from Rot-13}
data [any-string!]
/local scrambled rot-chars rot-char
][
rot-chars: {anabobcpcdqderefsfgtghuhivijwjkxklylmzmANABOBCPCDQDEREFSFGTGHUHIVIJWJKXKLYLMZM}
scrambled: copy ""
foreach char data [
if none? (rot-char: select/case rot-chars char) [rot-char: char]
insert tail scrambled :rot-char
]
return scrambled
]
Order a professional Sparkling White Smiles Custom Teeth Whitening System online and get BIG SAVINGS!
ReplyDelete* Up to 10 shades whiter in days!
* Professional Results Are Guaranteed.
* As good as your dentist, for a fraction of the cost.
* Same strength as dentists use.