TobyInkster.co.uk
01/08/2007: PHP Encryption Class
Here’s a simple PHP library for encoding and decoding text.
Examples:
<?php
$trivialencoder_auto = FALSE;
include 'TrivialEncoder.class.php';
$manager = new TrivialEncoderManager;
$plaintext = 'Hello world';
// Chain together Triple DES, Memfrob and Base64 encoding.
// Note: 3DES encoding is passed an (optional) key "mysecretkey".
$encoding = '3des mysecretkey;memfrob;base64';
$cyphertext = $manager->encode($encoding, $plaintext);
echo $manager->decode($encoding, $cyphertext); // Hello world
?>