SimpleCrypt PHP class for simple cryptography

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!

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn

1 thought on “SimpleCrypt PHP class for simple cryptography

  1. Pingback: Install mcrypt PHP extension on Mac OS X Lion | Glen Scott - Keeping it simple

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.