mIRC (more secure) encode and decode

By Dani_l11 on Jul 11, 2011

I was bored so I made another small snippet.

It uses this de- and encoding: http://en.wikipedia.org/wiki/Transposition_cipher#Columnar_transposition

You have to give a keyword, and then what to en- or decode; example:
$Encodex(Dani,This is my encoded text) will return cdt^_s¶O¬hi`¶n¬_o¶dn¬j¬o

Now that doesn't make any sense, does it?
But $decodex(Dani,cdt^_s¶O¬hi`¶n¬_o¶dn¬j¬o) returns "This is my encoded text" again, hooray, it works!

Besides the columnar transposition (as explained on wiki), it also 'encodes' the outcome of that encryption by moving the CHR codes of every character by an (unpredictable) number, based on the MD5 of the keyword. This explains the weird blocks.

It is way more secure than the mIRC built in $decode/$encode and it also is really hard to crack for people if they don't have the correct keyword.

Just being one letter of with the keyword in the $decodex alias returns some stuff nobody understand, example: $decodex(Daniel,cdt^_s¶O¬hi¶n¬`_o¶dn¬j¬o) -> Sgh hrlx mbndc dws $decodex(Wani,cdt^_s¶O¬hi¶n¬`_o¶dn¬j¬o) ->  kjuVuk {goqefp fvgvzg

Now that doesn't make any sense, while its just one or two characters off from the real key!

Also, it's using those ¶ and ¬ because mIRC automatically filters double spaces, which causes problems with this script, so instead i'm replacing those spaces with those weird characters and afterwards replacing those spaces back.

(Above all hocus pocus for you? Doesn't matter! You will learn eventually)

Go ahead and have some fun with it, comment if you have any questions or something else. Try it out ;-)

Usage once more:
$Encodex(Key,Text) -> returns encoded string
$decodex(Key,Encoded string) -> returns text
/encodex Key,Text -> echo's encoded string
/decodex Key,Encoded string -> echo's text

Only restrictions are that you cannot use comma's in the key, and the key is incasesensitive. Also trying to encode some weird symbols (E.G. µ, ¶ and ¬) CAN cause problems.

alias encodex {
  if (!$isid) tokenize 44 $1-
  var %kwoord = $lower($1)
  var %encode = $replace($2,$chr(32),¬)
  var %x = 1,%y = 1
  while (%x <= $len(%encode)) {
    if (%y > $len(%kwoord)) var %y = 1
    var %c. [ $+ [ %y ] ] %c. [ $+ [ %y ] ] $+ $mid(%encode,%x,1)
    inc %x
    inc %y
  }
  var %kwoords = $regsubex($sorttok($left($regsubex(%kwoord,/(.)/g,$asc(\1) $+ - $+ \n $+ .),-1),46,n),/\d*-/g,)
  var %x = 1,%msg
  while (%x <= $numtok(%kwoords,46)) {
    var %msg = %msg $+ $chr(32) %c. [ $+ [ $gettok(%kwoords,%x,46) ] ] $+ ¶
    inc %x
  }
  var %msg = $left(%msg,-1)
  var %nr = $left($regsubex($md5(%kwoord),/\D/g,),1)
  $iif($isid,return,echo -a) $replace($regsubex(%msg,/([^¬¶])/g,$chr($calc($asc(\1) - %nr))),$chr(44),¾¿@zrL¢#)
}
alias decodex {
  if (!$isid) tokenize 44 $1-
  var %kwoord = $lower($1)
  var %nr = $left($regsubex($md5(%kwoord),/\D/g,),1)
  var %decode $regsubex($replace($2-,¾¿@zrL¢#,$chr(44)),/([^¬¶])/g,$chr($calc($asc(\1) + %nr)))
  var %kwoords = $regsubex($sorttok($left($regsubex(%kwoord,/(.)/g,$asc(\1) $+ - $+ \n $+ .),-1),46,n),/\d*-/g,)
  var %x = 1
  while (%x <= $numtok(%decode,182)) {
    var %c. [ $+ [ $gettok(%kwoords,%x,46) ] ] $gettok(%decode,%x,182)
    inc %x
  }
  var %x = 1
  while (%x <= $len($remove(%decode,$chr(32)))) {
    var %y = 1
    while (%y <= $numtok(%decode,182)) {
      var %msg = %msg $+ $mid(%c. [ $+ [ %y ] ],%x,1)
      inc %y
    }
    inc %x
  }
  $iif($isid,return,echo -a) $replace(%msg,¬,$chr(32))
}

Comments

Sign in to comment.
}{exer   -  Jul 15, 2011

Nice Script :)
ty I like it

 Respond  
Bielie   -  Jul 15, 2011

Not trying to hurt your feelings or anything bro! You are a legit msl writer. I was just trying to use it and it made me think :)

 Respond  
Dani_l11   -  Jul 14, 2011

Not neccesairly (heard of LulzSec hacking Sony? If they only encoded it...), but I never said it was useful. I mean, if we have to delete every single script from hawkee that is useless...

I made it as a replacement for the default $encode and $decode identifiers.

 Respond  
Bielie   -  Jul 13, 2011

Its kind of useless. Cuz you save your ini's for example in the encoded thingy. And then Decode it with another thingy.

If they can access that ini. They probably also can access the script that contains the alias :p

 Respond  
Dani_l11   -  Jul 12, 2011

Saving or dealing with passwords, needing to storage information (in public?), without anyone else knowning the information (cause you need the correct key), or just having fun.

I know this isn't the most usefull snippet out there, but it's a good replacement for the built-in $encode and $decode.

 Respond  
Bielie   -  Jul 12, 2011

Can you tell me where this could be applied :)?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.