Skip to content

Encode/decode JavaScript to/from Japanese style emoticons.

License

Notifications You must be signed in to change notification settings

jfcherng/php-aacodec

Repository files navigation

php-aacodec

GitHub Workflow Status (branch) Packagist Packagist Version Project license GitHub stars Donate to this project using Paypal

A PHP implementation of the aaencode.

Installation

$ composer require jfcherng/php-aacodec

Usage

After executing the following PHP code,

<?php

use Jfcherng\AaCodec\Codec;

require_once __DIR__ . '/../vendor/autoload.php';

$jsCode = 'alert("hello world");';
$encodingLevel = 0; // larger to get a longer encoded js code

$encoded = Codec::encode($jsCode, $encodingLevel);
file_put_contents('encoded.js', $encoded);

$decoded = Codec::decode($encoded);
file_put_contents('decoded.js', $decoded);

encoded.js is now:

゚ω゚ノ=/`m´)ノ~┻━┻/['_'];o=(゚ー゚)=_=3;c=(゚Θ゚)=(゚ー゚)-(゚ー゚);(゚Д゚)=(゚Θ゚)=(o^_^o)/(o^_^o);(゚Д゚)={゚Θ゚:'_',゚ω゚ノ:((゚ω゚ノ==3) '_')[゚Θ゚],゚ー゚ノ:(゚ω゚ノ '_')[o^_^o-(゚Θ゚)],゚Д゚ノ:((゚ー゚==3) '_')[゚ー゚]};(゚Д゚)[゚Θ゚]=((゚ω゚ノ==3) '_')[c^_^o];(゚Д゚)['c']=((゚Д゚) '_')[(゚ー゚) (゚ー゚)-(゚Θ゚)];(゚Д゚)['o']=((゚Д゚) '_')[゚Θ゚];(゚o゚)=(゚Д゚)['c'] (゚Д゚)['o'] (゚ω゚ノ '_')[゚Θ゚] ((゚ω゚ノ==3) '_')[゚ー゚] ((゚Д゚) '_')[(゚ー゚) (゚ー゚)] ((゚ー゚==3) '_')[゚Θ゚] ((゚ー゚==3) '_')[(゚ー゚)-(゚Θ゚)] (゚Д゚)['c'] ((゚Д゚) '_')[(゚ー゚) (゚ー゚)] (゚Д゚)['o'] ((゚ー゚==3) '_')[゚Θ゚];(゚Д゚)['_']=(o^_^o)[゚o゚][゚o゚];(゚ε゚)=((゚ー゚==3) '_')[゚Θ゚] (゚Д゚).゚Д゚ノ ((゚Д゚) '_')[(゚ー゚) (゚ー゚)] ((゚ー゚==3) '_')[o^_^o-゚Θ゚] ((゚ー゚==3) '_')[゚Θ゚] (゚ω゚ノ '_')[゚Θ゚];(゚ー゚) =(゚Θ゚);(゚Д゚)[゚ε゚]='\\';(゚Д゚).゚Θ゚ノ=(゚Д゚ ゚ー゚)[o^_^o-(゚Θ゚)];(o゚ー゚o)=(゚ω゚ノ '_')[c^_^o];(゚Д゚)[゚o゚]='\"';(゚Д゚)['_']((゚Д゚)['_'](゚ε゚ (゚Д゚)[゚o゚] (゚Д゚)[゚ε゚] (゚Θ゚) (゚ー゚) (゚Θ゚) (゚Д゚)[゚ε゚] (゚Θ゚) ((゚ー゚) (゚Θ゚)) (゚ー゚) (゚Д゚)[゚ε゚] (゚Θ゚) (゚ー゚) ((゚ー゚) (゚Θ゚)) (゚Д゚)[゚ε゚] (゚Θ゚) ((o^_^o) (o^_^o)) ((o^_^o)-(゚Θ゚)) (゚Д゚)[゚ε゚] (゚Θ゚) ((o^_^o) (o^_^o)) (゚ー゚) (゚Д゚)[゚ε゚] ((゚ー゚) (゚Θ゚)) (c^_^o) (゚Д゚)[゚ε゚] (゚ー゚) ((o^_^o)-(゚Θ゚)) (゚Д゚)[゚ε゚] (゚Θ゚) ((゚ー゚) (゚Θ゚)) (c^_^o) (゚Д゚)[゚ε゚] (゚Θ゚) (゚ー゚) ((゚ー゚) (゚Θ゚)) (゚Д゚)[゚ε゚] (゚Θ゚) ((゚ー゚) (゚Θ゚)) (゚ー゚) (゚Д゚)[゚ε゚] (゚Θ゚) ((゚ー゚) (゚Θ゚)) (゚ー゚) (゚Д゚)[゚ε゚] (゚Θ゚) ((゚ー゚) (゚Θ゚)) ((゚ー゚) (o^_^o)) (゚Д゚)[゚ε゚] (゚ー゚) (c^_^o) (゚Д゚)[゚ε゚] (゚Θ゚) ((o^_^o) (o^_^o)) ((゚ー゚) (o^_^o)) (゚Д゚)[゚ε゚] (゚Θ゚) ((゚ー゚) (゚Θ゚)) ((゚ー゚) (o^_^o)) (゚Д゚)[゚ε゚] (゚Θ゚) ((o^_^o) (o^_^o)) ((o^_^o)-(゚Θ゚)) (゚Д゚)[゚ε゚] (゚Θ゚) ((゚ー゚) (゚Θ゚)) (゚ー゚) (゚Д゚)[゚ε゚] (゚Θ゚) (゚ー゚) (゚ー゚) (゚Д゚)[゚ε゚] (゚ー゚) ((o^_^o)-(゚Θ゚)) (゚Д゚)[゚ε゚] ((゚ー゚) (゚Θ゚)) (゚Θ゚) (゚Д゚)[゚ε゚] ((゚ー゚) (o^_^o)) (o^_^o) (゚Д゚)[゚o゚])(゚Θ゚))('_');

decoded.js is now:

alert("hello world");