I am trying to make a module that will read a blowfish encrypted tcl script. However I am stumped on how. I know this is the type of module people dont release, however, is there one out there that someone made to help others? I have looked at woobie.mod and blowfish.mod. Can anyone help?
<font size=-1>[ This Message was edited by: Stumped on 2002-03-10 04:02 ]</font>
It depends what you want to do. For instance, if you just want a new tcl command like "source_encrypted" that you pass a filename and a decryption key, that's easy. If you want to make it load an encrypted config file, or maybe even compile the config file into the bot, that's entirely different.
I was going to use blowfish since that is already in the bot. The module would code in the key it used, and it would be loaded from the configuration file like all the others. Just with a special command in the conf file like sourceencrypt scripts/bah.tcl.
There's no builtin access to blowfish, since it's possible to load other encryption modules. The builtin functions simply access whatever encryption module is currently loaded. Eggdrop may be switching to AES (rijndael) in the next version, so if you use the builtin encryption and don't provide your own, then your encrypted scripts may become unusable.
Ok, so copy woobie.mod, copy some code to create a new tcl command called sourceencrypt, and then fill it in.
To create a new tcl command, look at an existing module for an example. For instance, the server module has its tcl functions in tclserv.c, and creates them with the add_tcl_commands() call in server_start().
The Tcl function should read in the file, decrypt it, and pass the result to Tcl_EvalGlobal. You can find plenty of examples of new Tcl functions in tclserv.c (already mentioned).