PHP Classes

Sencryption: Encrypt, decrypt and hash arbitrary data

Recommend this page to a friend!
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2012-07-16 (5 years ago) RSS 2.0 feedNot yet rated by the usersTotal: 570 All time: 5,213 This week: 690Up
Version License PHP version Categories
sencryption 0.1GNU General Publi...5PHP 5, Cryptography
Description Author

This class can encrypt, decrypt and hash arbitrary data.

It can take a given data string and encrypt it using a given key.

The class can also do the opposite, i.e. decrypt the data using the same key.

It can also compute the hash value of a given data string using an optional salt.

The encryption cypher is a configurable parameter.

Name: Sildaekar Decrura <contact>
Classes: 2 packages by
Country: United States United States
Age: 27
All time rank: 2567318 in United States United States
Week rank: 1096 Up118 in United States United States Up

The sencryption class is a PHP class used to create secure methods of encryption,
decryption, and hashing.  The class is currently version 0.1 which means it may
still be a little buggy and be a little slow.


$data="This is my secure string to be encrypted!";

$enc=new sencryption($key);


echo "Encrypted Data: ".$encrypted."<br>";
echo "Decrypted Data: ".$decrypted;

Within the class there are only 4 useful functions which are described more in detail below.


The load_ciphers function must be called whenever you are going to perform
any type of encryption or decryption.  This function populates the ciphers array
within the class with the needed encryption ciphers.

The $loc variable here is in fact optional (you can leave it blank), or you may
use it to specify the mcrypt library directory within your server or you can use
it to specify a .txt file to read the cipher's from.

NOTE: I would highly recommend loading the cipher's from a .txt file as if you
obtain them from the server or from your mcrypt library's directory they may
change when PHP or the mcrypt library is updated.

Also, the positions of the ciphers within the array MUST remain the same if you
wish to be able to correctly decrypt your data.


This function performs the actual encryption of data. Simply pass data along to
it and it will return the data encrypted.


This function performs the decryption of data.  Pass the encrypted data to this
function and it will return the plain text.


This is the hashing function of the class and will securely hash data that is
passed to it.  The $salt variable is optional, although it is reccommended if
you are using the class simply for encryption.
  Files folder image Files  
File Role Description
Accessible without login Plain text file Readme.txt Doc. ReadMe File
Plain text file senc.class.php Class Class File

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:5,213
This week:690Up