Articles Tagged with “Trivial-encoder”
19/08/2007: TrivialEncoder/0.2
An update to my PHP encryption class. Despite the name, it’s becoming a pretty sophisticated encyption machine. New encryption algorithms added:
- Vigenerè cypher
- One-Time Pad
- Bruce Schneier’s Superencyption
- Various other methods using the MCrypt library
The TrivialEncoderManager class has been obsoleted by TE_Machine, an abstract class with several different child classes for encoding, decoding and analysis. TE_Machine has a greatly improved parser for methods, which has made it a lot easier for me to add additional functionality such as the ability to analyse an encryption technique to see how strong it would be, and to check whether the output would be ASCII-safe. TrivialEncoderManager is still present, but is deprecated and will be removed next release.
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
?>