common.php 504 B

1234567891011121314151617181920212223242526
  1. <?php
  2. if(!extension_loaded('phpcrypto')) {
  3. dl('phpcrypto.so');
  4. }
  5. $module = 'phpcrypto';
  6. $functions = get_extension_funcs($module);
  7. echo "Functions available in the test extension:\n";
  8. foreach($functions as $func) {
  9. echo $func."\n";
  10. }
  11. echo "\n";
  12. //国密
  13. function string2hex($string){
  14. $hex = '';
  15. for($i = 0;$i < strlen($string); $i++){
  16. $ch = dechex(ord($string[$i]));
  17. if(strlen($ch)==1){
  18. $ch = "0".$ch;
  19. }
  20. $hex .=$ch;
  21. }
  22. return $hex;
  23. }