This is a very old article. It has been imported from older blogging software, and the formatting, images, etc may have been lost. Some links may be broken. Some of the information may no longer be correct. Opinions expressed in this article may no longer be held.
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.
Usage
<?php
$trivialencoder_auto = FALSE;
include 'TrivialEncoder.class.php';
$method = 'twofish "mypassword"; xor 7; vig "ace"; base64;';
$plain_text = "Test message.\n";
$encrypted_text = TE_Machine_Encoder::Go($method, $plain_text);
$decrypted_text = TE_Machine_Decoder::Go($method, $encrypted_text);
print $decrypted_text; // prints "Test message.\n"
1?>