I have just pushed a simple class called SimpleCrypt
to GitHub:
https://github.com/glenscott/simple-crypt
This is an OO wrapper around the most common mcrypt functions. An example of use:
require_once 'SimpleCrypt.php'; // show the algorithms available for use print_r( SimpleCrypt::get_available_algorithms() ); // encrypt a string using Triple DES (CBC mode) $crypt = new SimpleCrypt( 'tripledes', 'mysecretkey' ); $encrypted_data = $crypt->encrypt_data( 'stringtoencrypt' ); echo "Encrypted data: " . bin2hex( $encrypted_data ) . "\n"; echo "Decrypted data: " . $crypt->decrypt_data( $encrypted_data ) . "\n";
If you find it useful, please let me know!
Pingback: Install mcrypt PHP extension on Mac OS X Lion | Glen Scott - Keeping it simple