TobyInkster.co.uk

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:

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"
?>

Download

Comments

Comment 001

Note: I’ve just updated the attached TE_Machine.class.php file because of a small error in TE_Machine_Decoder. If you downloaded a copy of that file before the update, you should replace it.

Author: Toby Inkster
Date: Monday, 20th August 2007, 3:47pm (UTC)

Comment 004

Very nice class. There is a small error though: line 532 of TrivialEncoder should read:

$machine = new TE_Machine_Encoder;

(you have omitted the “new” keyword”

Author: ivan
Date: Tuesday, 23rd September 2008, 2:08pm (UTC)

Comments are moderated and may take one or two days to show up on the site. You can bypass comment moderation by signing up as a registered user.