<?php
/**
 * Link         :   http://www.phpcorner.net
 * User         :   qingbing<780042175@qq.com>
 * Date         :   2019-05-23
 * Version      :   1.0
 */

namespace Test;

use Helper\Crypt;
use TestCore\Tester;

class TestCrypt extends Tester
{
    /**
     * 执行函数
     * @return mixed|void
     */
    public function run()
    {
        $crypt = Crypt::getInstance();
        $crypt->setPrivateKey('private_key_001');
        $str = $crypt->encode('11', 'public_key_001');
        var_dump($str);
        $str = $crypt->decode($str, 'public_key_001');
        var_dump($str);

        $crypt->setPrivateKey('private_key_002');
        $str = $crypt->encode('测试中文加密', 'public_key_002');
        var_dump($str);
        $str = $crypt->decode($str, 'public_key_002');
        var_dump($str);
    }
}