Encryption/Multiple Whisper

 

Why encryption?

While whisper allows two people to chat in privacy in a room with other people in it, it does not allow for three or more to chat privately. The following code allows the user to encrypt what he/she is saying so that only people with this script can understand. Also, at palaces where chatlogs is turned on, all conversations on the server are recorded --- this includes ordinary chat, whispers, esp, page, roommsg, etc. It does not, however, include localmsg which is done purely on the client side. Since the decrypted message is only given to the user as a localmsg, all that is recorded at the server side is the encrypted message, effectively defeating the purpose of chatlogs.

How the script works, along with the encryption algorithm (and its advantages over "naive" algorithms) is discussed below. The encryption code is given in the following link. Please note that I have set up this file as an independent Cyborg.ipt, so you can use it as it is; but, if you want to paste the scripts into your existing Cyborg.ipt file, take them out of my ON OUTCHAT section and paste them into your ON OUTCHAT section, and similarly with the ON INCHAT section.

encrypt.txt (Please read the terms of use!)

 

 

How to use the script.

1. The script allows for many "channels" of encryption --- there is over a hundred billion channels. This means that you must "tune" into the correct channel being used by your friends in order to listen to what they are saying. Of course, your friends will have to tell you what channel they're using for you to tune in. To select a random channel, say

start enc

Your encryptor will now be set to a random channel. If you now want to communicate that channel to anyone in the room, you say

tune enc

Anyone else in the room who hears you say this will be tuned into your channel. If you want to tune in only select individuals, just whisper "tune enc" to each one by one. You can tune anyone in at any point by just saying "tune enc".

2. To encode a message, say

enc <message>

You will not see any talk bubble, but an encrypted message will appear in the logs of everyone in the room. Only users with the script and tuned into your channel will see what you said as a LOCALMSG.

 

The Algorithm.

Before discussing how this script works, let me point out a "naive" encryption technique in which one substitutes for each letter of the alphabet a unique symbol so that there is a one-to-one correspondence between each English letter and each of the encryption symbols. While this is 90% of the battle to disguising what is being said, it is easy to crack because one need only look for reoccurring patterns to see that "the", for example, is always rendered as "%^&". So, "%" stands for "t", "^" for "h", and "&" for "e". Of course, it is not easy to recognize that "%^&" stands for "the" in the first place, but given the grammar of English and other clues, it is not too difficult --- as the British found, much to the chagrin of the Germans during WWII.

The algorithm employed here works differently. A random number generator (RNG) is used to produce a sequence of pseudo random numbers. The RNG I use is discussed in Knuth's "Art of Computer Programming":

crypt := ( mult * crypt + incr ) % 32768

where mult, incr and the initial value of crypt are what set the encryption channel --- these can have any value provided that mult % 4 = 1 and incr % 2 = 1. These constraints ensure the maximum period for the sequence of pseudo random numbers generated. Here crypt will always be between 0 and 32767. This value is then scaled to the number of symbols being encrypted using

lcrypt := crypt * size / 32768

where size = 26 for the lowercase letters of the alphabet --- I convert the string to be encrypted to lowercase right up front. The encrypted message is all uppercase. lcrypt defines an offset which is applied as follows: assume lcrypt = 3, then "a" is mapped onto "D" which is three letters ahead in the alphabet, "b" is mapped to "E", etc.

Original Letter
Encrypted Letter
a
D
b
E
c
F
d
G
...
...
w
Z
x
A
y
B
z
C

Note how the letters at the end of the alphabet wrap to the beginning.

Once the first letter in the message is encrypted with offset lcrypt = 3, lcrypt for the next letter is obtained from the RNG, and the process is repeated until all the letters in the message have been encrypted. Thus, not only are, say, all t's not substituted by the same symbol from message to message, they are not even necessarily represented by the same symbol within the same message!

Decryption occurs by undoing this algorithm. Since both the encryptor and decryptor start with the same mult, incr and initial value of crypt in the RNG, they can both generate the same sequence of pseudo random numbers and so both know what offset should be employed for the next letter in the message. Of course, if you start with a different mult, incr and initial value of crypt, then you are tuned into a different encryption channel and you cannot calculate the correct offsets. Tuning in another user brings him/her into the correct point in the sequence of pseudo random numbers.

Have fun!