PHP code example of aibayanyu / tp-rsa

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

    

aibayanyu / tp-rsa example snippets



function test(){
    $rsa = new \aibayanyu\rsa\Auth();
    $str = "sssss";   
    // 私钥加密
    $enStr = $rsa->pkEncrypt($str);
    // 公钥解密
    $rsa->puDecrypt($enStr);
    // 公钥加密
    $pu = $rsa->puEncrypt($str);
    // 私钥解密
    $rsa->pkDecrypt($pu);
}

function test1(){
    $str = "sssss";
    // 私钥加密
    $enStr = pk_encode($str);
    // 公钥解密
    pu_decode($enStr);
    // 公钥加密
    $pu = pu_encode($str);
    // 私钥解密
    pk_decode($pu);
}
shell script
php think rsa:create