From 1c435f546087d12ada685c4e5d44452ff58fd1ae Mon Sep 17 00:00:00 2001 From: Adam Backstrom Date: Tue, 10 Jul 2012 10:25:18 -0400 Subject: [PATCH] base64 encode/decode, and random hashes --- classes.php | 30 ++++++++++++++++++++++++++++++ index.php | 9 +++++++++ style.css | 4 ++++ 3 files changed, 43 insertions(+) diff --git a/classes.php b/classes.php index a09ab8a..1c2312c 100644 --- a/classes.php +++ b/classes.php @@ -53,6 +53,36 @@ class ActionQuotedPrintableDecode extends AbstractAction } } +class ActionBase64Encode extends AbstractAction +{ + public function __construct( $value ) + { + parent::__construct( $value ); + $this->setContainer( new TextareaContainer ); + $this->setFormatter( new EchoFormatter ); + } + + public function decode() + { + return base64_encode( $this->value ); + } +} + +class ActionBase64Decode extends AbstractAction +{ + public function __construct( $value ) + { + parent::__construct( $value ); + $this->setContainer( new TextareaContainer ); + $this->setFormatter( new EchoFormatter ); + } + + public function decode() + { + return base64_decode( $this->value ); + } +} + class ActionUrldecode extends AbstractAction { public function __construct( $value ) diff --git a/index.php b/index.php index b6c0aac..402f144 100644 --- a/index.php +++ b/index.php @@ -37,6 +37,8 @@ if( 'POST' === $_SERVER['REQUEST_METHOD'] ) { + + @@ -44,5 +46,12 @@ if( 'POST' === $_SERVER['REQUEST_METHOD'] ) { +

Randomness

+ + + diff --git a/style.css b/style.css index 2402457..434ab2e 100644 --- a/style.css +++ b/style.css @@ -22,3 +22,7 @@ h2 { float: left; padding: 10px; } + +.randomness-box { + width: 30em; +}