PHP code example of oh86 / sm_cryptor

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

    

oh86 / sm_cryptor example snippets


use Oh86\SmCryptor\Facades\Cryptor;

>>> Cryptor::sm3("123")
=> "6e0f9e14344c5406a0cf5a3b4dfb665f87f4a771a31f7edbb5c72874a32b2957"
>>> Cryptor::hmacSm3("123")
=> "2d0c6f15f8ba4570f1f9688cb162ce874d883d08837c08c68f34eb8abfc40624"
>>> 
>>> $en = Cryptor::sm4Encrypt("123")
=> "819b7dad97bc32f0f490a7e32efcf886"
>>> Cryptor::sm4Decrypt($en)
=> "123"
shell
composer install oh86/sm_cryptor
php artisan vendor:publish --provider='Oh86\SmCryptor\SmCryptorServiceProvider'