PHP code example of maker-phper / sm4ecb

1. Go to this page and download the library: Download maker-phper/sm4ecb 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/ */

    

maker-phper / sm4ecb example snippets




$sm4 = new \Sm4ecb\SM4();

$key = 'FECDD61C0BB7C1E291663BE11AA8106A';
$str = "测试urlaaaaaaaa";

$sm4->SetKey($key);
$backData = $sm4->Encrypt($str);
$data = $sm4->Decrypt($backData);
var_dump($backData) ;
echo "<br>";
var_dump($data) ;