Skip to content

Commit

Permalink
修改支持到7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lpilp committed Dec 20, 2021
1 parent d12d153 commit 94ce8d5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"minimum-stability": "stable",
"require": {
"php": ">=7.4",
"php": ">=7.2",
"mdanter/ecc": "^1.0"
},
"autoload": {
Expand Down
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions test/tsm4.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,21 @@


echo "==== test sm4 sm4-cbc============";
echo "\nopenssl: ".bin2hex($raw = openssl_encrypt($data, "sm4", $key, OPENSSL_RAW_DATA,$iv));
echo "\nphp sm4: ".$hex = $sm4->encrypt($data,'sm4',$iv); //default is cbc
echo "\nphp sm4-cbc: ".$sm4->encrypt($data,'sm4-cbc',$iv); //default is cbc
echo "\nphp decode: ".$sm4->decrypt($raw,'sm4',$iv,'raw');
echo "\nphp decode: ".$sm4->decrypt($hex,'sm4',$iv,'hex');

echo "\n==== test sm4-ecb============";
echo "\nopenssl-ecb: ".bin2hex($raw = openssl_encrypt($data, "sm4-ecb", $key, OPENSSL_RAW_DATA));
echo "\nphp sm4-ecb: ".$hex = $sm4->encrypt($data,'sm4-ecb');
echo "\nphp decode: ".$sm4->decrypt($raw,'sm4-ecb','','raw');
echo "\nphp decode: ".$sm4->decrypt($hex,'sm4-ecb','','hex');

echo "\n==== test sm4-ofb============";
echo "\nopenssl-ofb: ".bin2hex($raw = openssl_encrypt($data, "sm4-ofb", $key, OPENSSL_RAW_DATA,$iv));
echo "\nphp sm4-ofb: ".$hex = $sm4->encrypt($data,'sm4-ofb',$iv);
echo "\nphp decode: ".$sm4->decrypt($raw,'sm4-ofb',$iv,'raw');
echo "\nphp decode: ".$sm4->decrypt($hex,'sm4-ofb',$iv,'hex');

echo "\n==== test sm4-cfb============";
echo "\nopenssl-cfb: ".bin2hex($raw = openssl_encrypt($data, "sm4-cfb", $key, OPENSSL_RAW_DATA,$iv));
echo "\nphp sm4-cfb: ".$hex = $sm4->encrypt($data,'sm4-cfb',$iv);
echo "\nphp decode: ".$sm4->decrypt($raw,'sm4-cfb',$iv,'raw');
echo "\nphp decode: ".$sm4->decrypt($hex,'sm4-cfb',$iv,'hex');

echo "\n==== test sm4-ctr============";
echo "\nopenssl-ctr: ".bin2hex($raw = openssl_encrypt($data, "sm4-ctr", $key, OPENSSL_RAW_DATA,$iv));
echo "\nphp sm4-ctr: ".$hex = $sm4->encrypt($data,'sm4-ctr',$iv);
echo "\nphp decode: ".$sm4->decrypt($raw,'sm4-ctr',$iv,'raw');
echo "\nphp decode: ".$sm4->decrypt($hex,'sm4-ctr',$iv,'hex');

0 comments on commit 94ce8d5

Please sign in to comment.