Location: PHPKode > projects > Homeless Mangement Information System > hmis/include/encryption_class.inc
<?php
//*Client Data System, Copyright (C) 2000, 2001, 2002, 2003 Tedd Kelleher.  This is free software, subject to the 
//*GNU GENERAL PUBLIC LICENSE, Version 2, June 1991 (in file named gpl.txt), which should accompany 
//*any distribution of this file.  Tedd Kelleher can be contacted at hide@address.com

//To activate encryption, remove all the "////" from lines below 

class Encryption
{
    var $td;
    //var $iv;
    var $key;
    
    
    
    function Encryption ()
    {
        //$this->td = mcrypt_module_open ('rijndael-256', '', 'ofb', '');
        ////$this->td = mcrypt_module_open (MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, '');
        
        /* Create the IV and determine the keysize length */
        //$this->iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($this->td), MCRYPT_DEV_RANDOM);
        ////$ks = mcrypt_enc_get_key_size ($this->td);
        
        /* Create key */
        ////$this->key = substr (md5 ('very secret key'), 0, $ks);
        
        /* Intialize encryption */
        //mcrypt_generic_init ($this->td, $key, $iv);
    }
    
    
    
    function encrypt_data ( $unencrypted )
    {
        /* Encrypt data */
        //mcrypt_generic_init ($this->td, $this->key, $this->iv);
        ////mcrypt_generic_init ($this->td, $this->key, '1234567891234566');
        
        $encrypted = $unencrypted;//Fluff
        ////$encrypted = mcrypt_generic ( $this->td, $unencrypted );
        //mcrypt_generic_deinit ($this->td);
        
        
        $encrypted = base64_encode ( $encrypted );
        
        
        return $encrypted;
    }
    
    
    
    function decrypt_data ( $encrypted )
    {
        /* Decrypt encrypted string */
        $encrypted = base64_decode ( $encrypted );
        ////mcrypt_generic_init ($this->td, $this->key, '1234567891234566');
        $decrypted = $encrypted; //Fluff
        ////$decrypted = mdecrypt_generic ($this->td, $encrypted);
        
        $ret_val = trim ($decrypted);//."\n";
        //mcrypt_generic_deinit ($this->td);
        
        return $ret_val;
    }
    
    
    
    function close_encryption ()
    {
        ////mcrypt_module_close ($this->td);
    }
    
} //end Encryption class




 /* Open the cipher */

 /* Terminate encryption handler */
////    mcrypt_generic_deinit ($td);

 /* Initialize encryption module for decryption */
////    mcrypt_generic_init ($td, $key, $iv);

 /* Terminate decryption handle and close module */
////    mcrypt_generic_deinit ($td);

    /* Show string */



?>
Return current item: Homeless Mangement Information System