egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

string encryption without eggdrop tcl commands?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Thu Jun 28, 2007 10:27 am    Post subject: string encryption without eggdrop tcl commands? Reply with quote

I am about to write my encrypted dcc chat. Dcc chat from tclsh to eggdrop is kinda easy with socket.

Eggdrop has the decrypt and encrypt command, very easy to use. But tclsh doesn`t has this command since it`s not an eggdrop.

Can you advise me a premade script with secure encryption?
_________________
socketapi | Code less, create more.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Jun 28, 2007 10:37 am    Post subject: Reply with quote

The encryption used by eggdrop is in most cases based on the blowfish algorith. Unfortunately, this is a somewhat calculation-heavy encryption, making implementation in pure tcl "sluggish". I would therefore recommend implementing it as a loadable module to gain some performance.

That said, a nice site on the blowfish algorithm (with several examples in different languages) can be found here.

As for your request for premade scripts, unfortunately I can't think of any at this moment.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Thu Jun 28, 2007 1:36 pm    Post subject: Reply with quote

Can't you use something from tcllib like yencode of uuencode?

http://tcllib.sourceforge.net/doc/index.html
_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Thu Jun 28, 2007 6:00 pm    Post subject: Reply with quote

I simple want to encrypt a plaintext with a password, send it over an unsecure connection and decrypt it with the same key on the other point.

http://tcllib.sourceforge.net/doc/aes.html looks fine and is currently known as secure. The example on the page isn`t enough for me, I need an example for decrypt aswell.

Would be cool if someone who understand that could write an example de- and encrypt.
_________________
socketapi | Code less, create more.
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Fri Jun 29, 2007 10:20 am    Post subject: Reply with quote

It would be the same as the encrypt and decrypt command:

Code:
set key "my_key"
set data "some data here to encrypt"
set encrypted [aes::encrypt $key $data]
set decrypted [aes::decrypt $key $encrypted]


or

Code:
set key "my_key"
set data "some data blah blib"
set encrypted [aes::aes -mode cbc -dir encrypt -key $key $data]
set decrypted [aes::aes -mode cbc -dir decrypt -key $key $encrypted]


Thats how i have used it in the past, hope this helps.
_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Sat Jun 30, 2007 3:35 am    Post subject: Reply with quote

Tosser^^, I used your example. But got an error "invalid key size "48": must be one of 128, 192 or 256".
_________________
socketapi | Code less, create more.
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sat Jun 30, 2007 3:52 am    Post subject: Reply with quote

"my_key" = 6 bytes (8 bits per byte) = 48 bits.

128 bits = 16 bytes, 192 bits = 24 bytes, 256 bits = 32 bytes
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat Jun 30, 2007 7:33 am    Post subject: Reply with quote

Worth mentioning is that each character equals 1 byte.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
sKy
Op


Joined: 14 Apr 2005
Posts: 194
Location: Germany

PostPosted: Sun Jul 01, 2007 6:51 pm    Post subject: Reply with quote

I still don`t get how this is supposed to work.

Code:
proc test { } {
   package require aes
   set sixteen_bytes_key_data "1234567890123456"
   set sixteen_byte_iv "1234567890123456"
   set Key [aes::Init cbc $sixteen_bytes_key_data $sixteen_byte_iv]
   set plaintext "1234567890123456"
   set ciphertext [aes::Encrypt $Key $plaintext]
   puts "ciphertext: $ciphertext"
   set decr [aes::Decrypt $Key $ciphertext]
   puts "decr: $decr"
   aes::Final $Key
}

_________________
socketapi | Code less, create more.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber