PHP Classes

File: README.txt

Recommend this page to a friend!
  Classes of Jason Sheets   Crypt Class   README.txt   Download  
File: README.txt
Role: Documentation
Content type: text/plain
Description: Readme File
Class: Crypt Class
True Data Encryption and Decryption Class
Author: By
Last change: Fixed License
Date: 21 years ago
Size: 3,290 bytes
 

Contents

Class file image Download
Crypt Class README Description: Crypt Class is a wrapper around libmcrypt_ functions, it greatly simplifies the interface and adds new features and simplies many things. It provides an easy way to encrypt and decrypt data, it automatically creates the IV and extracts it for you later. Crypt Class stores the IV with the encrypted string so every time you encrypt a string it will look different but decrypt to the original value. Crypt Class also makes it easy to switch between encryption modes and ciphers. Example: Here is an example on how to encrypt the string "this is a test message" with the encryption key "test key". <?php // include crypt class file include('crypt_class.php'); // create an instance of the crypt class $crypt_class = new CRYPT_CLASS; // set the encryption cipher to twofish $crypt_class->set_cipher('twofish'); // set the cipher // set the mode to cfb (you should use cfb for strings and cbc for files) $crypt_class->set_mode('cfb'); // set encryption mode // set the encryption key to 'test key' $crypt_class->set_key('test key') // this is the data we want to encrypt $data = 'this is a test message'; // this will be the encrypted data $encrypted = $crypt_class->encrypt($data); // this is the decrypted data $decrypted = $crypt_class->decrypt($encrypted); ?> Author: Jason Sheets <jsheets@shadotech.com> 10/5/02 Support Feel free to e-mail me if you need help but please look at http://www.php.net/mcrypt. License: This class is distributed under the BSD License. Copyright (C) 2002 Jason Sheets <jsheets@shadonet.com>. All rights reserved. THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.