1. Go to this page and download the library: Download evit/php-gm-crypto library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
evit / php-gm-crypto example snippets
// If you are using a framework that does not support psr-4 autoloader, you need to explicitly import package from the vendor directory.
=> 'cbc',
// password, will be processed by substr(md5($key), 0, 16) if $config['hash']
'key' => '{replace-your-key-here}',
// the iv used by 'cbc' mode, will be will be processed by substr(md5($iv), 0, 16) if $config['hash']
'iv' => '{replace-your-iv-here}',
// weather do md5 to key and iv or not
'hash' => false
];
$sm4 = new EvitSM4Encryption($config);
// Determine whether openssl library is used
$algorithm = $sm4->isOpenssl() ? 'openssl' : 'php-gm-crypto';
var_dump("Algrithm is:{$algorithm}");
var_dump('Total time elapsed:' . number_format($end - $start, 8) . ' s');
composer
bash
composer
php
// If you are using a framework that does not support psr-4 autoloader, you need to explicitly import package from the vendor directory.
"SM3 hash result of '{$input}' is '{$output}'");
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.