PHP Classes
elePHPant
Icontem

Crypt Class: True Data Encryption and Decryption Class

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2002-11-24 (12 years ago) RSS 2.0 feedStarStarStar 53%Total: 6,607 This week: 3All time: 289 This week: 398Down
Version License Categories  
cryptclass 1.0.0BSD LicenseCryptography
Description Author  

Crypt Class is a wrapper around libmcrypt_ functions, it greatly simplifies the interface and adds new features like embedded IV. 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 uses libmcrypt so twofish, blowfish, aes, and many other "real" encryption ciphers are available.

Crypt Class also makes it easy to switch between encryption modes and ciphers.

Picture of Jason Sheets
Name: Jason Sheets <contact>
Classes: 4 packages by
Country: United States United States
Age: ???
All time rank: 13914 in United States United States
Week rank: 200 Down25 in United States United States Down

Details provided by the author  
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.
   
  Files folder image Files  
File Role Description
HTML file crypt_manual.html Doc. Extensive Documentation
Plain text file example.php Example Sample Script
Plain text file example1.php Example Another Example
Accessible without login Plain text file README.txt Doc. Readme File

 Version Control Unique User Downloads Download Rankings  
 0%Total:6,607All time:289
 This week:3This week:398Down
 User Ratings  
 
 All time
Utility:66%StarStarStarStar
Consistency:64%StarStarStarStar
Documentation:68%StarStarStarStar
Examples:64%StarStarStarStar
Tests:-
Videos:-
Overall:53%StarStarStar
Rank:1480