This article wasn't written by me, I'm just posting it for Liquixcat.


Title: BLOWing up the FISH


Some people seem to be finding INI files to be completly insecure.
They don't have to be.

You could use the file encoder, but that is relatively easy to hack and don't do much on encrypting except move some bytes around. Blowfish however uses algorithms and secures your file with 56-bit encryption. So what else can blowfish do?

Blowfish can do lots of things, especially in conjunction with other extensions like file object. You can encrypt/decrypt single files, multiple files, words or even your files you want noone else to be able to read.

So let's get started.



INI Encryption
if you don't know what an INI is or even if you don't know how to use it, then you should probably learn how to use that first.


This might be the simplest most under used way to encrypt your saves/data. First I'll how explain the code works then I'll just give you the code in one shot.


You have an INI made right?
so what's Set Encryption key to......?

Setting the encryption key is just how the extension will encrypt your file. it can be up to 448 bits in length and can be almost any character you can think of. (letters, numbers, &*!]{, etc.). Just don't forget what it is because you'll also need it to decrypt your file. So go ahead and set the code.


So what's Encrypt file.....?
So you're going to want to tell blowfish which file to actually encrypt. You can do this by going to "encrypt file". First enter the encryption key then the file. The file being exactly where your INI is. (Ex. appdrive$ + appdir$ + "myini.ini")
There you go, your file is encrypted. Easy huh?


So what's Decrypt file.....?
So now that the file is encrypted it's absolutly useless. Nothing will know what it is until it is decrypted. To do this use "decrypt file". Enter the same encryption key and the same INI file and TADA! It's decrypted.


The Code-----------------------

+On Event
()Set Encryption key to "7&g1hH7(!"
()Encrypt File > Set Encryption key to "7&g1hH7(!" > Set file to appdrive$ + appdir$ + "myini.ini"

+On Event
()Set Encryption key to "7&g1hH7(!"
()Decrypt File > Set Deryption key to "7&g1hH7(!" > Set file to appdrive$ + appdir$ + "myini.ini"

End Code------------------------



Encrypting A single file
You have a file you want noone else to see? It can be a picture, movie or text file. Doesn't matter. (You may want to keep it under a certain size, any more then 100MB could take a long time)

This is where our File Object will come in handy. So you know how to encrypt/decrypt now, but what if you want to specify a single file? Well File Object has a neat feature where is can call up a load object screen.

So how do I do that?
First set a File selector Title, something so the user knows what is going on. (Ex. Load File to Encrypt)
Then set selection mode to single
then open load file selector

After that is done the file will be remembered by File Object. So now encrypt the File like last time except when it asks for the file (last time it was appdrive$ + appdir$ + "myini.ini), just put in FileSelReturn$( "File" )

Remember it also needs to be decrypted so repear the steps above but for the "decrypt file" option.

The Code------------------------

+On Event
()Set Encryption key to "7&g1hH7(!"
()Encrypt File > Set Encryption key to "7&g1hH7(!" > Set file to FileSelReturn$( "File" )

+On Event
()Set Encryption key to "7&g1hH7(!"
()Decrypt File > Set Deryption key to "7&g1hH7(!" > Set file to FileSelReturn$( "File" )

End Code-------------------------



Encrypting Multiple Files
This is a little more complicated and requires basic knowledge of fast loop. Blowfish doesn't seem to like loops too much but you can get it working if you use groups (MMF Only).

I'm not going to go into it as I have an open source that's commented on exactly how to do this. it can be found at http://www.create-games.com/download.asp?id=5784 along with EXE of what it can do.

Good luck! Hopefully it helped some of you.