#file that contains the encryption algorithms. #redirects user to main page if tries to access this one, informs them of it if header redirect does not work if($PHP_SELF == "crypt.php") { header("Location: index.php"); echo 'Access to page only granted through proper submittal of form data from the main page.'; exit; } #encrypts data using vars provided, vars preceded with '&' are passed by refrence function encrypt($cipher, $mode, &$key, &$rawData, &$iv) { #opens mcrypt module and prepares vars $encData = "Encryption Error!! Go back and try again."; #gets replaced upon successful encrypiton $cipher = strtolower($cipher); $mode = strtolower($mode); $td = mcrypt_module_open($cipher, '',$mode, ''); $ivSize = mcrypt_enc_get_iv_size($td); if($key == "") $key = "password"; $key = substr($key, 0, mcrypt_enc_get_key_size($td)); if($iv == "") { $iv = mcrypt_create_iv($ivSize, MCRYPT_RAND); } elseif(strlen($iv) > $ivSize) { $iv = substr($iv, 0, $ivSize); } elseif(strlen($iv) < $ivSize) { $iv = str_pad($iv, $ivSize, 'x'); } #initialize encryption handle if (mcrypt_generic_init($td, $key, $iv) != -1) { #encrypt data $encData = mcrypt_generic($td, $rawData); #shutdown encryption mcrypt_generic_deinit($td); } mcrypt_module_close($td); return $encData; } #decrypts data using vars provided, vars preceded with '&' are passed by refrence function decrypt($cipher, $mode, &$key, &$encData, &$iv) { #opens mcrypt module and prepares vars $rawData = "Decryption Error!!"; #gets replaced upon successful decrypiton $cipher = strtolower($cipher); $mode = strtolower($mode); $td = mcrypt_module_open($cipher, '',$mode, ''); $ivSize = mcrypt_enc_get_iv_size($td); $key = substr($key, 0, mcrypt_enc_get_key_size($td)); if(strlen($iv) > $ivSize) { $iv = substr($iv, 0, $ivSize); } elseif(strlen($iv) < $ivSize) { $iv = str_pad($iv, $ivSize, 'x'); } #initialize decryption handle if (mcrypt_generic_init($td, $key, $iv) != -1) { #decrypt data $rawData = rtrim(mdecrypt_generic($td, $encData), "\0"); #trim to remove padding #shutdown encryption mcrypt_generic_deinit($td); } mcrypt_module_close($td); return $rawData; } ?> Quick Crypt

Encrypt and Decrypt anything you like.

•This system allows the user to encrypt, decrypt, and store ecrypted information online in a user-friendly format.

Please Login

 
Username: 
Password: 

Documentation

 
It is very important to read at least the documentation pertaining to the operation of this site.

It also includes descriptions of all of the different ciphers, modes, the IV, and some of the theory behind the encryption.

Site Documentation

Source Code

 
Quick Crypt is an open source project, protected by a GNU license. Includes install script for MySQL.

Download