Nitrous Encryption

By LIQUID_NiTrO on Jan 01, 2005

Uses two separate keys that work two different ways to transform the easily crackable $encode identifier into a medium-security encryption method.
To use the encryption, just copy and paste the script into your remotes and type "/encrypt on [key] [MIME count]". The key and the MIME count should both be whole numbers greater than 1, and MIME count should be less than key.
Anyone who you want to communicate with must also have this snippet and should use the same key and MIME count. Similarly you use "/encrypt off" to turn encryption off.
Thanks to Sigh_ for helping me with this one.
--Update--
Added $nitrous alias as an easy way to encrypt and decrypt strings for use in other scripts. Usage is $nitrous(string,key,mimecount). Without any properties it will encrypt the string, or you can specify dec or decrypt as the property to decrypt it.
--Update Again 12/3/06--
You will now see what you type, as requested.

alias encrypt {
  if ( $1 == off ) {
    set %enc off
    echo $colour(info) -a * Encryption is now OFF
  }

  elseif ( $1 == on ) {
    if ( !$2 ) && ( !%k ) {
      echo $colour(info) -a * You must specify a key!
      halt
    }
    elseif ( !$3 ) && ( !%mc ) {
      echo $colour(info) -a * You must specify a MIME count!
      halt
    }
    set %k $2
    set %mc $3
    if ( %k < 1 ) || ( $chr(46) isin %k ) || ( %k !isnum ) {
      echo $colour(info) -a * Invalid Key
      unset %k
      halt
    }
    if ( %mc < %k ) || ( $chr(46) isin %mc ) || ( %mc !isnum ) {
      echo $colour(info) -a * Invalid MIME count
      unset %mc
      halt
    }
    set %enc on
    echo $colour(info) -a * Encryption is now ON, using  $+ %k $+  as key,  $+ %mc $+  as MIME count
  }
  else {
    echo $colour(info) -a * SYNTAX: /encrypt <on|off> [key] [MIME count]
  }
}
on ^*:input:*: {
  if ( %enc == on ) && ( $left($1,1) != $readini(mirc.ini,text,commandchar) ) {
    var %c = 1,%f = $1-
    while (%c <= %k) {
      %f = $encode(%f,$iif(%mc // %c,m,u))
      inc %c
    }
    echo -a $+(<,$me,>) %f
    .msg $active $chr(384) %f
    halt
  }
}
on ^*:TEXT:*:*: {
  if ( $1 == $chr(384) ) {
    var %c = %k,%f = $2-
    while (%c) {
      %f = $decode(%f,$iif(%mc // %c,m,u))
      dec %c
    } 
    echo $colour(text) -a $+(<,$nick,>) %f
    haltdef
  }
}
alias nitrous {
  if ( !$2 ) || ( !$3 ) || ( $2 !isnum ) || ( $3 !isnum ) {
    return $null
  }
  if ( !$prop ) {
    var %f = $1,%c = 1
    while ( %c <= $2 ) {
      %f = $encode(%f,$iif($3 // %c,m,u))
      inc %c
    }
    return %f
  }
  elseif ( $prop == dec ) || ( $prop == decrypt) {
    var %f = $1,%c = $2
    while (%c) {
      %f = $decode(%f,$iif($3 // %c,m,u))
      dec %c
    }
    return %f
  }
}

Comments

Sign in to comment.
LightspeedDemon   -  Sep 16, 2007

Greetings...Ive a snafu n wonder if you may have a solution or workaround for it.
I copied and pasted your encryption snippet into a script called P&Plus, a script with heavy safeguards againt such things as DCC and queries.
It works...half-way. Ii will decrypt text but cannot encrypt...text comes out plaintext...
I tried the alias command n still no encrypt...

Any tips, tricks or snippet alterations I can try to get it going properly will be greatly appreciated.
In any case I must say great snippet n hella fun in a chatroom even though Im only getting half the picture so to speak ;)

 Respond  
CakerX   -  Feb 12, 2007

I must say I am impressed. You\'ve managed to provide read encryption, in a very short amount of code, without the use of a DLL.

Its not \"good\" or serious encryption, but its a great proof of concept(the concept being DLL-less encryption), and some inovative coding.

 Respond  
LIQUID_NiTrO   -  Dec 03, 2006

I\'ve added functionality for your 2nd request. Enjoy :)

 Respond  
ufo^hunter   -  Sep 15, 2006

We like this addon. We only can come up with two things you could add to it to make it better.

  1. A way to toggle it on and off by pushing like F5

That way when you\'re on multiple networks, you can turn it off to chat normal.

and

  1. A way to echo back what you type. You can see what someone types to you, but not a way to keep track of what you type. Not that that is a big thing, but it\'s still nice to know.

Like, echo back but still encrypt.

Thanks!

ufo^hunter

In lieu of contacting me on here, send me an email to:

conspiracyirc@hotmail.com

 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.