diff options
Diffstat (limited to 'tests/service')
| -rw-r--r-- | tests/service/entropy.php | 61 | ||||
| -rw-r--r-- | tests/service/memcached.php | 12 | ||||
| -rw-r--r-- | tests/service/redis.php | 27 |
3 files changed, 100 insertions, 0 deletions
diff --git a/tests/service/entropy.php b/tests/service/entropy.php new file mode 100644 index 0000000..6401ffd --- /dev/null +++ b/tests/service/entropy.php @@ -0,0 +1,61 @@ +<html> + <head> + <title>Dev Tools</title> + </head> + <body> + <h1>Supported Crypt/Encrypt Methods</h1> + + <table width="100%"> + <tr> + <td width="50%" valign="top"> + + <h2>CIPHER Methods</h2> + <pre> +<?php +$ciphers = openssl_get_cipher_methods(); +$ciphers_and_aliases = openssl_get_cipher_methods(true); +$cipher_aliases = array_diff($ciphers_and_aliases, $ciphers); + +print_r($ciphers); + +print_r($cipher_aliases); + +?> + </pre> + </td> + + <td width="50%" valign="top"> + + <h2>DIGER Methods</h2> + <pre> +<?php +$digests = openssl_get_md_methods(); +$digests_and_aliases = openssl_get_md_methods(true); +$digests_aliases = array_diff($digests_and_aliases, $digests); + +print_r($digests); + +print_r($digests_aliases); +?> + + </pre> + + <h2>HASH Algorythms</h2> + <pre> + <?php print_r( hash_algos() ); ?> + </pre> + + <h2>Random</h2> + <pre> +random_bytes() +32Bytes: <?=bin2hex(random_bytes(32))?> + </pre> + + + </td> + + </tr> + </table> + + </body> +</html> diff --git a/tests/service/memcached.php b/tests/service/memcached.php new file mode 100644 index 0000000..c925488 --- /dev/null +++ b/tests/service/memcached.php @@ -0,0 +1,12 @@ +<?php +$mc = new Memcached(); +$mc->addServer("mymemcached", 11211); +$mc->add("key1", "value1"); +$mc->add("key2", "value2"); +$mc->add("key3", "value3"); + +echo "key1 : " . $mc->get("key1") . "\n"; +echo "key2 : " . $mc->get("key2") . "\n"; +echo "key3 : " . $mc->get("key3") . "\n"; + +die();
\ No newline at end of file diff --git a/tests/service/redis.php b/tests/service/redis.php new file mode 100644 index 0000000..d9b7778 --- /dev/null +++ b/tests/service/redis.php @@ -0,0 +1,27 @@ +<?php + +$data = [ + 'test' => ['Redis', 'is', 'working'], + 'redis' => '!!' +]; + +try { + + $redis = new \Predis\Client([ + 'host' => 'redis' + ]); + + foreach($data as $key => $value) { + echo $key .' '; + $redis->set( $key, serialize($value), 'EX', 60 ); + } + echo "...\n\n"; + +} catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; +} + +$test = unserialize($redis->get('test')); +$redis = unserialize($redis->get('redis')); + +echo implode(' ', $test) . $redis;
\ No newline at end of file |
