;~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
; Name:
; $encrypt() && /encrypt
;
; Author:
; Sparkle
;
; Contact:
; E-mail: sparkle@moondust.be
; IRC: /server irc.dal.net (@#mIRC , @#Helpdesk)
; IRC: /server irc.undernet.org (@#mIRC.net , @#mIRC-Scripts)
;
; What is this $encrypt() && /encrypt ?
;
; It is an identifier and a command , meant to make a simple encryption to a string (text/number), a replacement of $encode() and $decode() for encrypting/decrypting passwords. "Explained in the FAQ section"
; $encrypt() && /encrypt is a local alias scripted in mIRC scripting language.;
;
; This identifier/command will use a While loop to convert your text into ascii characters, each letter has its ascii value, and so, the whole string will be converted to some sort of ascii characters.
;
; $encrypt() && /encrypt will work both ways, mean to encrypt and decrypt the string "see the Syntax section".
;
;
;
;
; Syntax:
;
; $encrypt(Thisisatest) , $encrypt(This is a test)
;
; Example lines to show the encryption and decryption.
;
; $encrypt() examples
; //VAR %text thisismytext | VAR %string $encrypt(%text) | echo -a �04 %text �05 $encrypt(%string)
; //VAR %text this is another text | VAR %string $encrypt(%text) | echo -a �04 %text �05 $encrypt(%string)
; //VAR %text ôh mï G0D 1 c4n u53 th15 too 1001001101 | VAR %string $encrypt(%text) | echo -a �04 %text �05 $encrypt(%string)
; //VAR %text $encrypt(IamTestingThis) | VAR %string $encrypt(%text) | echo -a �04 %text �05 $encrypt(%string)
; //VAR %text $encrypt(I am testing with spaces) | VAR %string $encrypt(%text) | echo -a �04 %text �05 $encrypt(%string)
;
; /encrypt examples
; //VAR %text thisismytext | VAR %string $encrypt(%text) | echo -a %string | /encrypt %string
; //VAR %text this is another text | VAR %string $encrypt(%text) | echo -a %string | /encrypt %string
; //VAR %text ôh mï G0D 1 c4n u53 th15 too 1001001101 | VAR %string $encrypt(%text) | echo -a �04 %text �05 $encrypt(%string)
; //VAR %text $encrypt(IamTestingThis) | VAR %string $encrypt(%text) | echo -a %string | /encrypt %string
; //VAR %text $encrypt(I am testing with spaces) | VAR %string $encrypt(%text) | echo -a %string | /encrypt %string
;
;
;
; Note:
;
; 1] It is highly recommended to store the encrypted string in a hash table, due to windows characters mapping, as if you store them in a text file you may get a wrong output result.
; 2] Changing This variable "%§text.key = 0" while you have a stored data will damage the results, so make sure that ALL stored data are encrypted with the same key.
;
;
;
; Installation:
;
; 1] If you have recieved this file via DCC type "/load -rs $getdirencrypt.mrc" WITHOUT "".
; 2] If you have downloaded this file, you can
; a] You can copy it to your mIRC directory and type "/load -rs encrypt.mrc" WITHOUT "".
; b] You can copy the file contents and just paste them in your mIRC script editor ->
; - ALT + R
; - File > New
; - Paste the contents
; - File > Save
; - Click OK or just close the scripts editor
;
;
;
; FAQ:
;
; 1] What does this provide as an advantage over $encode/$decode ?
; A: The code won't be exploitable if you change the %§text.key variable key,
; as if someone send you an exploited message and you have your encryption key set as 12,
; and this exploited text is encrypted with a diff key, it will never decrypt and/or give
; a correct result.
;
; 2] How do I change this key ?
; A: Check the Status/Menubar popups, click on "Change Encryption key" and enter a key value "NUMBERS ONLY", Or just type /setenckey in any window and press enter.
;
; 3] Why it is better for me to store the encrypted data in a hash table ?
; A: Because some characters will not display correctly if echoed /echo %string,
; but while they are stored in the hash tables, they will be called and decrypted correctly.
;
; 4] What are the un-supported characters for this encryption ?
; A: None.
;
;
;
; Updates:
;
; 1] Enabled using the code as command line /encrypt.
; 2] Added option to change the encryption key.
; 3] Now using hash table to store and retrive the encryption key.
; 4] Updated documentation.
; 5] Changed the code a bit in order to allow new options.
; 6] Made sure that prevenc alias will ONLY work under $encrypt() /encrypt alias "local alias and $isid"
; 7] Snippet works with mIRC 6.17 "ONLY" due to using $qt() identifier.
;
;~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
;DO NOT edit below unless you know what you are doing.
;-Events
ON *:LOAD:{
IF (!$hget(§encrypt)) {
.HMAKE -s §encrypt 10
}
VAR %§text.key.temp = $input(Enter key value (160 is the default),eoq,Enter Encryption Key,160)
.HADD -m §encrypt §encrypt.key %§text.key.temp
.HSAVE -o §encrypt $qt($scriptdirencrypt.hsh)
}
ON *:START:{
IF (!$hget(§encrypt)) {
.HMAKE -s §encrypt 10
}
.HLOAD -n §encrypt $qt($scriptdirencrypt.hsh)
}
;-Aliases
ALIAS encrypt {
TOKENIZE 32 $1-
VAR %§text.string = $1-
VAR %§text.spaces = $numtok(%§text.string,32), %§text.number = 1
WHILE (%§text.number <= %§text.spaces) {
VAR %§text.result = %§text.result $prevenc($gettok(%§text.string,%§text.number,32))
INC %§text.number
}
IF ($isid) RETURN %§text.result
ELSE ECHO -a %§text.result
}
ALIAS -l prevenc {
IF ($isid) {
VAR %§text.key = $hget(§encrypt,§encrypt.key), %§text = $1-
VAR %§text.len = $len(%§text)
WHILE (%§text.len) {
VAR %§text.output = %§text.output $+ $chr($calc(%§text.key - $asc($mid(%§text,%§text.len,1))))
DEC %§text.len
}
RETURN %§text.output
}
}
ALIAS setenckey {
VAR %§text.key.temp = $input(Enter key value (160 is the default),eoq,Enter Encryption Key,160)
HADD -m §encrypt §encrypt.key %§text.key.temp
HSAVE -o §encrypt $qt($scriptdirencrypt.hsh)
}
;you can remove this part
;-Menu
MENU STATUS,MENUBAR {
-
Change Encryption key:setenckey
-
}
- EOF