[FilterScript] TinyJumble - a FULLY custom coder/decoder
#1

GvalWhzoyr
ol Nrebgnpgvpf
About
This was...originally going to be built to write a "coded" or jumbled message, and that's it. I ran into an error I never knew about, and a forum member by the name of Vince helped me through it, and mentioned that 26 of the same line was inefficient. I had to agree, so I got to work compacting it after I said I could probably make a stock for this "jumbler." (https://sampforum.blast.hk/showthread.php?tid=517222) Well those 30 lines were crafted into 8, and this stock can jumble from 1 alphabet, to another alphabet by using a loop within a loop. I can't tell you how excited I was to make it work and to be able to show it to the public.

pawn Код:
stock TinyJumble(str[], alphabet[], alphabet2[])
{//TinyJumble was written and created by Aerotactics
    new JumbledString[128];
    strins(JumbledString, str, 0);
    new i = 0;ILoop:
    new j = 0;JLoop:
    if(JumbledString[i] == alphabet[j] && JumbledString[i] != '\0'){JumbledString[i] = alphabet2[j]; i++; goto ILoop;}
    j++;if(j < 64) {goto JLoop;}
    i++;if(i < 128) {goto ILoop;}
    return JumbledString;
}
How does it work?
What this does is compare each character in a string to an "alphabet," and if the character matches, change the character to the corresponding character in a second alphabet. This continues for each and every character.

Let's look at the function in an example:
pawn Код:
SCM(playerid, COLOR_WHITE,TinyJumble("This is a String","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz","ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba"));
And I know you're thinking "the hell is this" but hear me out. Let's look specifically at the alphabets:
Quote:

"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw xyz"
"ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfed cba"

The first alphabet is the one that the TinyJumble will check for in the string "This is a String". The second alphabet is what character will replace the first character, for instance the "T" will be replaced by "H", then the "h" will be replaced with "s", and so on.

Those alphabets do take up a lot of space, so just like defining a color, you can define your alphabets:
pawn Код:
#define ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
#define BACKWARDS "ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba"
#define ROT13 "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm"
And your output would now read:
SendClientMessage(playerid, COLOR_WHITE, TinyJumble("This is a String",ALPHABET,BACKWARDS));

What about DE-crypting?
Conveniently, the defined ALPHABET and BACKWARDS as well as ALPHABET and ROT13 are mirrors of each other, A = N & N = A in ROT13. Since that is the case, all you have to do is send the jumbled message back through the same line:
TinyJumble("Guvf vf n Fgevat",ALPHABET,ROT13)

And it will return as This is a String. When the alphabets are not mirrored, all you have to do is reverse the scan order:
TinyJumble("Guvf vf n Fgevat",ROT13,ALPHABET)

Meaning it will take the ROT13 message, and change it to the default ALPHABET.

What is ROT13? Rotation 13 is a rotation between the first 13 letters, and the last 13 letters of the alphabet. It's definitely one of the more simple decodings, meaning if you know it's ROT13, you already know how to decode it.

What else can it do?
You name it. This can be used as a custom hasher (wouldn't recommend it), it can be used as a fictional language, and you can even jumble a jumbled message!
TinyJumble(TinyJumble(string,ALPHABET,ALIEN),ALIEN,SWEAR))

The string is an input string.
The first jumble changes it from the standard alphabet to a custom alphabet ALIEN.
The second jumble changes the ALIEN string to another fictional alphabet SWEAR.

This method is possible, but sometimes, if you jumble more than one alphabet, there's a chance that a letter may be corrupted on the way back through the decrypting.

This stock by default is able use more than just the alphabet. You can use special characters as well, but I would avoid punctuation in your alphabets.

You call this a filterscript?! It's just a stock!
True, but back when it was 30 lines long, it was going to be released as a filterscript. After making it as small as humanly possible, and still able to be read, I used the filterscript it was in for testing. Of course, I'm releasing that filterscript down below. Another reason was because I needed to explain how and why it works. I'm no teacher though, so I apologize if the guide is a bit vague.

How can I write a command to jumble messages?
pawn Код:
#define COLOR_WHITE 0xFFFFFFFF
#define SCM SendClientMessage // easier scripting lol

CMD:jumble(playerid,params[])
{
    new string[128];
    new alpha[12];
    if(sscanf(params,"s[12]s[128]",alpha,string)) return SCM(playerid, COLOR_WHITE, "Usage: /jumble [alphabet] [string]");
    if(!strcmp(alpha,"backwards")) SCM(playerid, COLOR_WHITE, TinyJumble(string,ALPHABET,BACKWARDS));
    if(!strcmp(alpha,"rot13")) SCM(playerid, COLOR_WHITE, TinyJumble(string,ALPHABET,ROT13));
    if(!strcmp(alpha,"vowels")) SCM(playerid, COLOR_WHITE, TinyJumble(string,ALPHABET,VOWELS));
    return 1;
}
How can I write a command to DE-jumble messages?
pawn Код:
CMD:dejumble(playerid,params[])
{
    new string[128];
    new alpha[12];
    if(sscanf(params,"s[12]s[128]",alpha,string)) return SCM(playerid, COLOR_WHITE, "Usage: /dejumble [alphabet] [string]");
    if(!strcmp(alpha,"backwards"))return SCM(playerid, COLOR_WHITE, TinyJumble(string,BACKWARDS,ALPHABET));
    return 1;
}
Why the name "TinyJumble"
Good question! Originally, it was going to be named The Jumbler (as the filterscript name implies), but when I was testing the stock I named it "TinyJumble" and it was more fitting.

Can I take this as my own?
No.

You deserve all the rep in the world!
Not a question, but thanks for your enthusiasm.

Download: Jumbler FS (Mediafire)
Reply
#2

What does it do? there is some SS's ?
Reply
#3

such unique
Reply
#4

Quote:
Originally Posted by DemME
Посмотреть сообщение
What does it do? there is some SS's ?
you don't need screenshot for everything.
Reply
#5

Quote:
Originally Posted by Calgon
Посмотреть сообщение
such unique
so doge, wow

Quote:
Originally Posted by iZN
Посмотреть сообщение
you don't need screenshot for everything.
I was honestly going to add a screenshot but didn't think it was necessary. Might as well make a video for it perhaps, would make more sense than a screenshot (and I'm not being sarcastic lol)
Reply
#6

Screenshot?
Reply
#7

It seams useless to me. Like what can you use this for?
Reply
#8

Well done mate. +rep.
Reply
#9

Quite interesting, honestly. Haven't seen any type of "Jumbler" before. I'm sure it could be used for hidden messages, etc.

Great job bud.
Reply
#10

Quote:
Originally Posted by iRaiDeN
Посмотреть сообщение
Screenshot?
Read the comment just before yours.

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
It seams useless to me. Like what can you use this for?
Read the thread where it says "What else can it do."
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)