libsodium.php 559 B

123456789101112131415161718192021222324
  1. <?php
  2. $br = (php_sapi_name() == "cli")? "":"<br>";
  3. if(!extension_loaded('libsodium')) {
  4. dl('libsodium.' . PHP_SHLIB_SUFFIX);
  5. }
  6. $module = 'libsodium';
  7. $functions = get_extension_funcs($module);
  8. echo "Functions available in the test extension:$br\n";
  9. foreach($functions as $func) {
  10. echo $func."$br\n";
  11. }
  12. echo "$br\n";
  13. $function = 'sodium_memzero';
  14. $exit = 0;
  15. if (extension_loaded($module)) {
  16. $str = $function($module);
  17. } else {
  18. $str = "Module $module is not compiled into PHP";
  19. $exit = 255;
  20. }
  21. echo "$str\n";
  22. exit($exit);
  23. ?>