|
illyism Wanderer
Joined: 09 Dec 2007 Posts: 58
|
Posted: Mon Mar 31, 2008 9:30 pm
encrypt/decrypt-er |
this is a script I made to talk with other people and avoid from being heard by others, get the other person this script, and you can talk freely.
Simply type CRYPT.
Quote: |
#CLASS {codetalk}
#ALIAS encrypt {
#class params
#var /paramlist ""
#var /newparamlist ""
#var /endparam ""
#LOOP %numparam( ) {#additem paramlist %param( %i)}
#noop
#var /numparamlist %numitems( @paramlist)
#loop @numparamlist {#additem newparamlist %item( @paramlist, %i)}
#var 1param %replace( @newparamlist, a, z1)
#var 2param %replace( @1param, b, y2)
#var 3param %replace( @2param, c, x3)
#var 4param %replace( @3param, d, w4)
#var 5param %replace( @4param, e, v5)
#var 6param %replace( @5param, f, u6)
#var 7param %replace( @6param, g, t7)
#var 8param %replace( @7param, h, s8)
#var 9param %replace( @8param, i, r9)
#var 10param %replace( @9param, j, q10)
#var 11param %replace( @10param, k, p11)
#var 12param %replace( @11param, l, o12)
#var 13param %replace( @12param, m, n13)
#var 14param %replace( @13param, n, m14)
#var 15param %replace( @14param, o, l15)
#var 16param %replace( @15param, p, k16)
#var 17param %replace( @16param, q, j17)
#var 18param %replace( @17param, r, i18)
#var 19param %replace( @18param, s, h19)
#var 20param %replace( @19param, t, g20)
#var 21param %replace( @20param, u, f21)
#var 22param %replace( @21param, v, e22)
#var 23param %replace( @22param, w, d23)
#var 24param %replace( @23param, x, c24)
#var 25param %replace( @24param, y, b25)
#var 26param %replace( @25param, z, a26)
#var endparam %replace( @26param, "|", " ")
#echo @endparam
#noop
#class 0
}
#ALIAS decrypt {
#class params
#var /paramlist ""
#var /newparamlist ""
#var /endparam ""
#LOOP %numparam( ) {#additem paramlist %param( %i)}
#noop
#var /numparamlist %numitems( @paramlist)
#loop @numparamlist {#additem newparamlist %item( @paramlist, %i)}
#var 1param %replace( @newparamlist, z1, a)
#var 2param %replace( @1param, y2, b)
#var 3param %replace( @2param, x3, c)
#var 4param %replace( @3param, w4, d)
#var 5param %replace( @4param, v5, e)
#var 6param %replace( @5param, u6, f)
#var 7param %replace( @6param, t7, g)
#var 8param %replace( @7param, s8, h)
#var 9param %replace( @8param, r9, i)
#var 10param %replace( @9param, q10, j)
#var 11param %replace( @10param, p11, k)
#var 12param %replace( @11param, o12, l)
#var 13param %replace( @12param, n13, m)
#var 14param %replace( @13param, m14, n)
#var 15param %replace( @14param, l15, o)
#var 16param %replace( @15param, k16, p)
#var 17param %replace( @16param, j17, q)
#var 18param %replace( @17param, i18, r)
#var 19param %replace( @18param, h19, s)
#var 20param %replace( @19param, g20, t)
#var 21param %replace( @20param, f21, u)
#var 22param %replace( @21param, e22, v)
#var 23param %replace( @22param, d23, w)
#var 24param %replace( @23param, c24, x)
#var 25param %replace( @24param, b25, y)
#var 26param %replace( @25param, a26, z)
#var endparam %replace( @26param, "|", " ")
#noop
#var 1param %replace( @endparam, z1, a)
#var 2param %replace( @1param, y2, b)
#var 3param %replace( @2param, x3, c)
#var 4param %replace( @3param, w4, d)
#var 5param %replace( @4param, v5, e)
#var 6param %replace( @5param, u6, f)
#var 7param %replace( @6param, t7, g)
#var 8param %replace( @7param, s8, h)
#var 9param %replace( @8param, r9, i)
#var 10param %replace( @9param, q10, j)
#var 11param %replace( @10param, p11, k)
#var 12param %replace( @11param, o12, l)
#var 13param %replace( @12param, n13, m)
#var 14param %replace( @13param, m14, n)
#var 15param %replace( @14param, l15, o)
#var 16param %replace( @15param, k16, p)
#var 17param %replace( @16param, j17, q)
#var 18param %replace( @17param, i18, r)
#var 19param %replace( @18param, h19, s)
#var 20param %replace( @19param, g20, t)
#var 21param %replace( @20param, f21, u)
#var 22param %replace( @21param, e22, v)
#var 23param %replace( @22param, d23, w)
#var 24param %replace( @23param, c24, x)
#var 25param %replace( @24param, b25, y)
#var 26param %replace( @25param, a26, z)
#var endparam %replace( @26param, "|", " ")
#echo @endparam
#noop
#noop
#class 0
}
#ALIAS crypt {#YESNO "What do you want to do?" {Encrypt:encrypt %clip} {Decrypt:decrypt %clip} {About:helpcodetalk}}
#ALIAS helpcodetalk {
#say
#echo %ansi( red) Codetalk help file
#say %ansi( blue)-made by Illyism.
#say %ansi( green)COMMANDS:
#say %ansi( white)ENCRYPT %ansi( yellow)codetalk is fun
#say %ansi( white)DECRYPT %ansi( yellow)c243l15d234e225g20a261l1512k1611
#say
#say Usage: copy your text to the clipboard, then type CRYPT.
#say A nice window will show up with choices.
#say Select either encrypt or decrypt, and it should show up.
}
#CLASS 0 |
export style
Code: |
#CLASS {codetalk}
#ALIAS encrypt {#class params;#var /paramlist "";#var /newparamlist "";#var /endparam "";#LOOP %numparam( ) {#additem paramlist %param( %i)};#noop;#var /numparamlist %numitems( @paramlist);#loop @numparamlist {#additem newparamlist %item( @paramlist, %i)};#var 1param %replace( @newparamlist, a, z1);#var 2param %replace( @1param, b, y2);#var 3param %replace( @2param, c, x3);#var 4param %replace( @3param, d, w4);#var 5param %replace( @4param, e, v5);#var 6param %replace( @5param, f, u6);#var 7param %replace( @6param, g, t7);#var 8param %replace( @7param, h, s8);#var 9param %replace( @8param, i, r9);#var 10param %replace( @9param, j, q10);#var 11param %replace( @10param, k, p11);#var 12param %replace( @11param, l, o12);#var 13param %replace( @12param, m, n13);#var 14param %replace( @13param, n, m14);#var 15param %replace( @14param, o, l15);#var 16param %replace( @15param, p, k16);#var 17param %replace( @16param, q, j17);#var 18param %replace( @17param, r, i18);#var 19param %replace( @18param, s, h19);#var 20param %replace( @19param, t, g20);#var 21param %replace( @20param, u, f21);#var 22param %replace( @21param, v, e22);#var 23param %replace( @22param, w, d23);#var 24param %replace( @23param, x, c24);#var 25param %replace( @24param, y, b25);#var 26param %replace( @25param, z, a26);#var endparam %replace( @26param, "|", " ");#echo @endparam;#noop;#class 0}
#ALIAS decrypt {#class params;#var /paramlist "";#var /newparamlist "";#var /endparam "";#LOOP %numparam( ) {#additem paramlist %param( %i)};#noop;#var /numparamlist %numitems( @paramlist);#loop @numparamlist {#additem newparamlist %item( @paramlist, %i)};#var 1param %replace( @newparamlist, z1, a);#var 2param %replace( @1param, y2, b);#var 3param %replace( @2param, x3, c);#var 4param %replace( @3param, w4, d);#var 5param %replace( @4param, v5, e);#var 6param %replace( @5param, u6, f);#var 7param %replace( @6param, t7, g);#var 8param %replace( @7param, s8, h);#var 9param %replace( @8param, r9, i);#var 10param %replace( @9param, q10, j);#var 11param %replace( @10param, p11, k);#var 12param %replace( @11param, o12, l);#var 13param %replace( @12param, n13, m);#var 14param %replace( @13param, m14, n);#var 15param %replace( @14param, l15, o);#var 16param %replace( @15param, k16, p);#var 17param %replace( @16param, j17, q);#var 18param %replace( @17param, i18, r);#var 19param %replace( @18param, h19, s);#var 20param %replace( @19param, g20, t);#var 21param %replace( @20param, f21, u);#var 22param %replace( @21param, e22, v);#var 23param %replace( @22param, d23, w);#var 24param %replace( @23param, c24, x);#var 25param %replace( @24param, b25, y);#var 26param %replace( @25param, a26, z);#var endparam %replace( @26param, "|", " ");#noop;#var 1param %replace( @endparam, z1, a);#var 2param %replace( @1param, y2, b);#var 3param %replace( @2param, x3, c);#var 4param %replace( @3param, w4, d);#var 5param %replace( @4param, v5, e);#var 6param %replace( @5param, u6, f);#var 7param %replace( @6param, t7, g);#var 8param %replace( @7param, s8, h);#var 9param %replace( @8param, r9, i);#var 10param %replace( @9param, q10, j);#var 11param %replace( @10param, p11, k);#var 12param %replace( @11param, o12, l);#var 13param %replace( @12param, n13, m);#var 14param %replace( @13param, m14, n);#var 15param %replace( @14param, l15, o);#var 16param %replace( @15param, k16, p);#var 17param %replace( @16param, j17, q);#var 18param %replace( @17param, i18, r);#var 19param %replace( @18param, h19, s);#var 20param %replace( @19param, g20, t);#var 21param %replace( @20param, f21, u);#var 22param %replace( @21param, e22, v);#var 23param %replace( @22param, d23, w);#var 24param %replace( @23param, c24, x);#var 25param %replace( @24param, b25, y);#var 26param %replace( @25param, a26, z);#var endparam %replace( @26param, "|", " ");#echo @endparam;#noop;#noop;#class 0}
#ALIAS crypt {#YESNO "What do you want to do?" {Encrypt:encrypt %clip} {Decrypt:decrypt %clip} {About:helpcodetalk}}
#ALIAS helpcodetalk {#say;#echo %ansi( red) Codetalk help file;#say %ansi( blue)-made by Illyism.;#say %ansi( green)COMMANDS:;#say %ansi( white)ENCRYPT %ansi( yellow)codetalk is fun;#say %ansi( white)DECRYPT %ansi( yellow)c243l15d234e225g20a261l1512k1611;#say;#say Usage: copy your text to the clipboard, then type CRYPT.;#say A nice window will show up with choices.;#say Select either encrypt or decrypt, and it should show up.}
#CLASS 0 |
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Mar 31, 2008 11:30 pm |
Very interesting. Seems to be somewhat based on the codetalk script I've got on here somewhere, which is in turn based off someone else...
I've got a Morse Chatter too, that is DIRECTLY based on someone elses.
But regardless of whether you based this on someone's work or created it uniquely, nice work :) |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
illyism Wanderer
Joined: 09 Dec 2007 Posts: 58
|
Posted: Thu Apr 03, 2008 12:31 am |
here is a rotate 13 example based on a morse chatter(I learned a lot from it).
i've enchanced the script and fixed some stuff.
Code: |
#CLASS {codetalk}
#ALIAS encrypt {
#var tempstr ""
#var strlen %len( %-1)
#var dumpstr "%-1"
#var dumpstr %replace( %-1, " ", "|")
#var dumpstr %lower( @dumpstr)
#loop 1,@strlen {
#var to_ins ""
#IF {%copy( @dumpstr, %i, 1)= "a"} {#var to_ins "n"}
#IF {%copy( @dumpstr, %i, 1)= "b"} {#var to_ins "o"}
#IF {%copy( @dumpstr, %i, 1)= "c"} {#var to_ins "p"}
#IF {%copy( @dumpstr, %i, 1)= "d"} {#var to_ins "q"}
#IF {%copy( @dumpstr, %i, 1)= "e"} {#var to_ins "r"}
#IF {%copy( @dumpstr, %i, 1)= "f"} {#var to_ins "s"}
#IF {%copy( @dumpstr, %i, 1)= "g"} {#var to_ins "t"}
#IF {%copy( @dumpstr, %i, 1)= "h"} {#var to_ins "u"}
#IF {%copy( @dumpstr, %i, 1)= "i"} {#var to_ins "v"}
#IF {%copy( @dumpstr, %i, 1)= "j"} {#var to_ins "w"}
#IF {%copy( @dumpstr, %i, 1)= "k"} {#var to_ins "x"}
#IF {%copy( @dumpstr, %i, 1)= "l"} {#var to_ins "y"}
#IF {%copy( @dumpstr, %i, 1)= "m"} {#var to_ins "z"}
#IF {%copy( @dumpstr, %i, 1)= "n"} {#var to_ins "a"}
#IF {%copy( @dumpstr, %i, 1)= "o"} {#var to_ins "b"}
#IF {%copy( @dumpstr, %i, 1)= "p"} {#var to_ins "c"}
#IF {%copy( @dumpstr, %i, 1)= "q"} {#var to_ins "d"}
#IF {%copy( @dumpstr, %i, 1)= "r"} {#var to_ins "e"}
#IF {%copy( @dumpstr, %i, 1)= "s"} {#var to_ins "f"}
#IF {%copy( @dumpstr, %i, 1)= "t"} {#var to_ins "g"}
#IF {%copy( @dumpstr, %i, 1)= "u"} {#var to_ins "h"}
#IF {%copy( @dumpstr, %i, 1)= "v"} {#var to_ins "i"}
#IF {%copy( @dumpstr, %i, 1)= "w"} {#var to_ins "j"}
#IF {%copy( @dumpstr, %i, 1)= "x"} {#var to_ins "k"}
#IF {%copy( @dumpstr, %i, 1)= "y"} {#var to_ins "l"}
#IF {%copy( @dumpstr, %i, 1)= "z"} {#var to_ins "m"}
#IF {%isnumber( %copy( @dumpstr, %i, 1))} {#var to_ins %copy( @dumpstr, %i, 1)}
#IF {%copy( @dumpstr, %i, 1)= "!"} {#var to_ins "!"}
#IF {%copy( @dumpstr, %i, 1)= "."} {#var to_ins "."}
#IF {%copy( @dumpstr, %i, 1)= "?"} {#var to_ins "?"}
#IF {%copy( @dumpstr, %i, 1)= "|"} {#var to_ins " "}
#var tempstr %insert( @to_ins, @tempstr, %len( @tempstr)+1)
}
#say @tempstr
}
#ALIAS crypt {#YESNO "What do you want to do?" {Rotate 13!:encrypt %clip} {About:helpcodetalk}}
#ALIAS helpcodetalk {
#say
#echo %ansi( red) Codetalk help file
#say %ansi( blue)-made by Illyism.
#say %ansi( green)COMMANDS:
#say %ansi( white)Encrypt %ansi( yellow)rotate thirteen
#say
#say Usage: copy your text to the clipboard, then type CRYPT.
#say A nice window will show up with choices.
}
#CLASS 0 |
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Apr 09, 2008 1:12 pm |
One thing I would suggest is taking a look at my morse chatter (if I posted it here, I'm no longer sure if it was here or another forum...) and looking at how I implemented it to be all command line and multi-channel.
For instance, doing:
morse chat Hi this is morse code
would send the morse to the chat channel as:
{Chat} Ralgith: Morse Code: (message in morse here)
I do this, so that anyone with the trigger will automatically get the decoded message, because I trigger off the "Morse Code:" and then use #ECHO to echo the decoded message back to them automatically.
I also do this on my code talk, which I never released to the public... but its the same thing as your ROT-13 at the most basic level. You just need a Unique prepend to it.
If you implement this into your code talkers, it will eliminate all the extra steps, and speed it all up a lot.
You can also make it catch special extra argument channels such as tell using something like this (I use %ismember() so that you can simply make it a list):
Code: |
#ALIAS morse {
#IF (%ismember(%1, "tell")) {
domorse %-3
#exec %1 %2 @morsemsg
} {
domorse %-2
#exec %1 @morsemsg
}
} |
As you can see, doing that easily will catch anything inside the %ismember list as being a command followed my an argument followed by the message, instead of a normal talk channel that uses the format of command message. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Apr 09, 2008 2:06 pm |
Couldn't you use %subchar to implement Rot13 very easily? I've never studied anything to do with cryptography, not even the basics, so forgive me if I'm wrong. But it seems a very simple operation.
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Thu Apr 10, 2008 3:10 pm |
Yes Fang you could :)
You just take your string and loop through each individual character replacing them with their Rot-13 equivalent. This is how I did my coded chat system. Thanks for mentioning it since I forgot ;) |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Apr 10, 2008 3:50 pm |
Why bother looping? I meant something like
%subchar("abcdefghijklmnopqrstuvwxyz","mnopqrstuvwxyzabcdefghijkl") |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Apr 14, 2008 5:39 pm |
I loop through each character because I have some special character checking. But yes, I get what you're saying, though you would need to do it as:
%subchar("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz","MNOPQRSTUVWXYZABCDEFGHIJKLmnopqrstuvwxyzabcdefghijkl")
in order to cover capped letters too, wouldn't you? |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
illyism Wanderer
Joined: 09 Dec 2007 Posts: 58
|
Posted: Wed Apr 23, 2008 3:23 pm |
ahhh, but I didn't know of subchar at the time of making this.
would be something like this, right?
#ALIAS encrypt {#var endparam %subchar(%-1,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm")
#echo @endparam
#noop
} |
|
|
|
illyism Wanderer
Joined: 09 Dec 2007 Posts: 58
|
Posted: Wed Apr 23, 2008 3:33 pm |
ok, here's the end result.
Code: |
#CLASS {codetalk}
#ALIAS encrypt {
#var endparam "%-1"
#var endingparam %subchar( @endparam, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm")
#echo @endingparam
#noop
}
#ALIAS crypt {#YESNO "What do you want to do?" {Rotate 13!:encrypt %clip} {About:helpcodetalk}}
#ALIAS helpcodetalk {
#say
#echo %ansi( red) Codetalk help file
#say %ansi( blue)-made by Illyism.
#say %ansi( green)COMMANDS:
#say %ansi( white)Encrypt %ansi( yellow)rotate thirteen
#say
#say Usage: copy your text to the clipboard, then type CRYPT.
#say A nice window will show up with choices.
}
#CLASS 0 |
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Apr 28, 2008 10:27 pm |
Yup, looking nice. Though in a teasing way I'm still of the opinion that you should implement it as automated instead of the chunky manual system you're using :)
Something like this:
Code: |
#CLASS {codetalk}
#ALIAS encrypt {
#var endparam "%-2"
#var endingparam %subchar( @endparam, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm")
#EXEC {%1 IysCrypt: @endingparam}
}
#ALIAS helpcodetalk {
#say
#echo %ansi( red) Codetalk help file
#say %ansi( blue)-made by Illyism. With additions and help from the Zuggsoft Forums.
#say %ansi( green)COMMANDS:
#say %ansi( white)Encrypt: %ansi( yellow)Implement Rotate Thirteen (ROT13) Simple Encryption upon text and output to a channel.
#say
#say Usage: encrypt ~(channel name~) ~<text to encrypt~>
#say Example: encrypt chat This text will be encrypted using ROT13.
}
#TRIGGER {IysCrypt: (*)} {
#var tmp_decrypt
#var decrypted %subchar( @tmp_decrypt, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm")
#ECHO Decrypted Text: @decrypted
}
#CLASS 0 |
This will automatically encrypt and decrypt on the fly. Much easier than the extra work. But that is just my opinion, use it if you'd like, trash it if you don't ;) |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
illyism Wanderer
Joined: 09 Dec 2007 Posts: 58
|
Posted: Tue Apr 29, 2008 5:30 pm |
you had a little bug on the decryption trigger.
so people, use his code:
Code: |
#CLASS {codetalk}
#ALIAS encrypt {
#var endparam "%-2"
#var endingparam %subchar( @endparam, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm")
#EXEC {%1 IysCrypt: @endingparam}
}
#ALIAS helpcodetalk {
#say
#echo %ansi( red) Codetalk help file
#say %ansi( blue)-made by Illyism. With additions and help from the Zuggsoft Forums.
#say %ansi( green)COMMANDS:
#say %ansi( white)Encrypt: %ansi( yellow)Implement Rotate Thirteen (ROT13) Simple Encryption upon text and output to a channel.
#say
#say Usage: encrypt ~(channel name~) ~<text to encrypt~>
#say Example: encrypt chat This text will be encrypted using ROT13.
}
#TRIGGER {IysCrypt: (*)} {
#var tmp_decrypt %1
#var decrypted %subchar( @tmp_decrypt, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm")
#ECHO Decrypted Text: @decrypted
}
#CLASS 0 |
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon May 12, 2008 5:45 pm |
Oops, nice catch lol! Stupid missing %1 :D
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|