I never saved my original AutoDecrypt function because it never worked, but I recreated this one, which should be the same. (Note: This is for the normal encryption, without ASCII characters.)
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind) {
if(AutoDecrypt && /^[0-9a-z]+$/i.test(Message)) {
var Decryption = Decrypt(Message, Key);
if(Origin == Messenger.MyName) {
Debug.Trace(" Encrypted message sent by current user.\n Decrypted: " + Decryption);
return Decryption;
}
else {
Debug.Trace(" Encrypted message sent by contact.\n Decrypted: " + Decryption);
return Decryption;
}
}
}
From the debugger, the script knows when the message is an encryption and whether it is sent by yourself. It also displays the decryption properly. It's just in the conversation window that it doesn't show the decryption. (The decryption should technically be at least one character shorter than the encryption, though this is only when the size is 1. With the default of 2, the decryption is less than half the length.)
quote:
Originally posted by SpunkyLoveMuff
If the source is openly editable by the user, it can be easily cracked can't it? Meaning that the whole thing would be useless? I'm liking the idea anyway and might give it a try for a bit
Yes, I had thought about that, which is why I put in the whole key idea.
Basically, you and the contact need to have the same key, otherwise you'll get completely random encryptions/decryptions. If you open up the source, you'll see that the encryption is VERY key-dependent:
1. The key generates a cipher which the message is passed through.
2. The key generates a sum (of the character codes) which adds and subtracts from each alternating character in the message.
That way, even if you know how to crack the code, you don't know what the key is to crack it with.
PS. Prefixed commands are on their way!