base64 encode/decode, and random hashes
This commit is contained in:
parent
347fd6f3c9
commit
1c435f5460
30
classes.php
30
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 )
|
||||
|
@ -37,6 +37,8 @@ if( 'POST' === $_SERVER['REQUEST_METHOD'] ) {
|
||||
<option value="Urlencode" <?php echo selected($_POST['action'], 'Urlencode'); ?>>urlencode()</option>
|
||||
<option value="Urldecode"<?php echo selected($_POST['action'], 'Urldecode'); ?>>urldecode()</option>
|
||||
<option value="Unserialize"<?php echo selected($_POST['action'], 'Unserialize'); ?>>unserialize()</option>
|
||||
<option value="Base64Decode"<?php echo selected($_POST['action'], 'Base64Decode'); ?>>base64_decode()</option>
|
||||
<option value="Base64Encode"<?php echo selected($_POST['action'], 'Base64Encode'); ?>>base64_encode()</option>
|
||||
<select>
|
||||
<input type="submit">
|
||||
</form>
|
||||
@ -44,5 +46,12 @@ if( 'POST' === $_SERVER['REQUEST_METHOD'] ) {
|
||||
<?php if( $action ) echo $action; ?>
|
||||
</div>
|
||||
|
||||
<h2>Randomness</h2>
|
||||
|
||||
<ul>
|
||||
<li>MD5: <input class="randomness-box" value="<?php echo md5(uniqid(mt_rand(), true)); ?>"></li>
|
||||
<li>SHA1: <input class="randomness-box" value="<?php echo sha1(uniqid(mt_rand(), true)); ?>"></li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user