Encoder/Decoder

By Matt5150 on May 20, 2013

Encoder/Decoder for mIRC

It also autodecode message in chan/query.

22:46:38 <@Scarecrow> DmNqvq%4%7%6

  • Decode: test 1 2 3
menu menubar,status,channel,query {
  Encoder
  .Dialog:dmn.enc
  .Set encryption key $+([,%enc.key,]):dmn.setkey $$?="Insert Number"
}
alias dmn.enc { if ($dialog(encoding)) { dialog -x encoding } | dialog -m encoding encoding }
alias code { msg $active DmN` $dmn.code(%enc.key,$1-) }
alias -l dmn.code {
  if (!%enc.key) { set %enc.key 5 }
  if ($isid) { var %iz = $1 | return $regsubex($2-,/(.)/g,$chr($xor($asc(\t),%iz))) }
  else { var %iz = $2 | echo $1 $+(,$color(info),* Decode:,$color(normal)) $regsubex($3-,/(.)/g,$chr($xor($asc(\t),%iz))) }
}
alias -l dmn.setkey { if ($1 isnum) { set %enc.key $1 } }
#autodecode on
on *:TEXT:*:#: { if ($1 === DmN`) { dmn.code $chan %enc.key $2- } }
on *:TEXT:*:?: { if ($1 === DmN`) { dmn.code $nick %enc.key $2- } }
#autodecode end
dialog encoding {
  title "Encoder [/dmn.enc]"
  size -1 -1 220 155
  check "Enable Auto-Decoding" 111, 5 5 180 15
  text "Encryption key:" 7, 5 27 89 15
  edit "" 8,95 25 20 20
  box "Encode/Decode" 112, 5 45 210 80
  edit "TEXT" 1, 10 60 200 20,autohs center
  button "Clear" 2, 20 80 50 20
  button "Encode/Decode" 3, 80 80 120 20
  edit "....." 4, 10 100 200 20,autohs center read
  button "+ Info" 5, 5 130 60 20
  button "ok" 6, 165 130 50 20, ok
  text "- To encode a text type '/code TEXT'" 113, 5 165 210 30
  text "- The Encryption key is a secret number for encoding\decoding text." 115, 5 195 210 30
}
on *:dialog:encoding:*:*:{
  if ($devent == init) {
    if ($group(#autodecode) = on) { did -cf encoding 111 }
    did -ar $dname 8 %enc.key
  }
  if ($devent == sclick) {
    if ($did = 2) { did -r encoding 1,4 }
    if ($did = 3) { did -ar encoding 4 $dmn.code(%enc.key,$did(1)) }
    if ($did = 111) { if ($group(#autodecode) = off) { .enable #autodecode } | else { .disable #autodecode } } 
    if ($did = 5) { if ($did(5).text = - Info) { did -ra encoding 5 + Info | dialog -s encoding $dialog(encoding).x $dialog(encoding).y 220 155 } | elseif ($did(5).text = + Info) { did -ra encoding 5 - Info | dialog -s encoding $dialog(encoding).x $dialog(encoding).y 220 225 } }
  }
  if ($devent == edit) && ($did = 8) { dmn.setkey $did(8).text  }
}
on *:load:{ set %enc.key 5 }
on *:unload:{ unset %enc.key }

Comments

Sign in to comment.
Sorasyn   -  May 20, 2013

On what basis does it encode? ASCII obfuscation? UTF-8? etc..?

Matt5150  -  May 21, 2013

it's a replace of characters, but if you don't know the right decryption key (a number) you can't decode it

Sorasyn  -  Jun 04, 2013

So obfuscation then? Obfuscating is relatively easy to crack though. Depending on character values, and the key, an obfuscated string could be cracked in a fraction of seconds.

IllogicTC  -  Jun 30, 2013

Sunny does have a point.

t116uy
y88op0
foobar

Could all be the same thing, just a simple replace, but after a while of seeing encrypted chatter people could gather enough of a database of it, and reference common cryptography information to crack it pretty quickly.

One solution would be to constantly switch the key, but it would have to be communicated to the person(s) you're speaking to, which would require a private/semi-private conversation with them anyway where the public could not discover the key.

Sorasyn  -  Jun 30, 2013

Not sure if mIRC allows manipulation of raw bytes, but stepping down in the data infrastructure would be a much more secure way of encryption. Encoding bytes based on a reversible byte cipher with a key is a similar technique used by other well known encryption algorithms such as Blowfish.

Sign in to comment

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.