Implementation of a blowfish class?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
PhantomCircuit
Forum Newbie
Posts: 3
Joined: Sat Jan 08, 2005 5:13 am

Implementation of a blowfish class?

Post by PhantomCircuit »

I found a class that encrypts and decrypts in blowfish and I wanted to know how to implement it in encrypting log files on my server (which are confidential by law in my county, yes my county (just slightly bigger than a city) has its own internet laws :roll: ).

The class can be found here

Thanks,
PhantomCircuit
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

call encryptBlock() with the data and key you wish to use (if you haven't previously set one)

use [php_man]file_get_contents()[/php_man] to load all of a log file into memory (provided memory allows)
PhantomCircuit
Forum Newbie
Posts: 3
Joined: Sat Jan 08, 2005 5:13 am

Post by PhantomCircuit »

Would that work?

Code: Select all

<?php 

include "class.inc";

$crypt=new Horde_Cipher_blowfish();
$key="big long key";
$text="cc#s";
$encrypted=$crypt->encryptBlock($text,$key);
$decrypted=$crypt->decryptBlock($encrypted,$key);
print $encrypted."<BR>".$decrypted;
?>

feyd | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

why not try it out?
Post Reply