diff --git a/snapporder/activate.php b/snapporder/activate.php new file mode 100644 index 0000000..a32e553 --- /dev/null +++ b/snapporder/activate.php @@ -0,0 +1,11 @@ + diff --git a/snapporder/config-sample.php b/snapporder/config-sample.php new file mode 100644 index 0000000..4daca45 --- /dev/null +++ b/snapporder/config-sample.php @@ -0,0 +1,4 @@ + diff --git a/snapporder/index.php b/snapporder/index.php new file mode 100644 index 0000000..dd1073a --- /dev/null +++ b/snapporder/index.php @@ -0,0 +1 @@ + diff --git a/snapporder/lib/CryptoHelper.php b/snapporder/lib/CryptoHelper.php new file mode 100644 index 0000000..582d5f2 --- /dev/null +++ b/snapporder/lib/CryptoHelper.php @@ -0,0 +1,61 @@ +$iv = $iv; + $this->$key = $key; + + } + + public function encrypt($str) + { + $iv = $this->iv; + + $td = mcrypt_module_open('rijndael-128', '', 'cbc', $iv); + + mcrypt_generic_init($td, $this->key, $iv); + $encrypted = mcrypt_generic($td, $str); + + mcrypt_generic_deinit($td); + mcrypt_module_close($td); + + return bin2hex($encrypted); + } + + public function decrypt($code) + { + $code = $this->hex2bin($code); + $iv = $this->iv; + + $td = mcrypt_module_open('rijndael-128', '', 'cbc', $iv); + + mcrypt_generic_init($td, $this->key, $iv); + $decrypted = mdecrypt_generic($td, $code); + + mcrypt_generic_deinit($td); + mcrypt_module_close($td); + + return utf8_encode(trim($decrypted)); + } + + private function hex2bin($hexdata) + { + $bindata = ''; + + for ($i = 0; $i < strlen($hexdata); $i += 2) { + $bindata .= chr(hexdec(substr($hexdata, $i, 2))); + } + + return $bindata; + } + +} + diff --git a/snapporder/lib/functions.php b/snapporder/lib/functions.php new file mode 100644 index 0000000..e69de29 diff --git a/snapporder/tests/integration.php b/snapporder/tests/integration.php new file mode 100644 index 0000000..e69de29