Code Monkey home page Code Monkey logo

rsa's Introduction

PHP - Rsa

rsa加解密库

一个直接调用C的动态库 , 速度比PHP框架自带的快。

功能特点

  • 支持公钥加密

  • 支持私钥解密

安装使用

依赖软件

一般依赖
  • PHP 7.0+

1、linux 安装

[root@test1 usr]# pwd
/usr
[root@test1 usr]# git clone https://github.com/php-so/Rsa.git
Cloning into 'Rsa'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 10 (delta 0), reused 4 (delta 0), pack-reused 0
Unpacking objects: 100% (10/10), done.

II、切换目录、复制动态库到PHP的扩展中、修改php.ini

[root@test1 usr]# cd Rsa/

[root@test1 Rsa]# cp ./rsa.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/

[root@test1 Rsa]# vim /usr/local/php/etc/php.ini
最下面添加2行
[Rsa]
extension=rsa.so

记得重新 php-fpm

查看模块
php -m 

2、使用案例

[root@test1 Rsa]# pwd
/usr/Rsa

[root@test1 Rsa]# cd test

/usr/local/php/bin/php rsa-test.php

成功响应

       _             ____            
 _ __ | |__  _ __   |  _ \ ___  __ _ 
| '_ \| '_ \| '_ \  | |_) / __|/ _` |
| |_) | | | | |_) | |  _ <\__ \ (_| |
| .__/|_| |_| .__/  |_| \_\___/\__,_|
|_|         |_|                      

string(29) "l love you! this is rsa test."

string(171) "YlrrEbSczaDzMDTbSrzNP3JHSt0Yo8HRcMh6n95SUOFXtusiRg1HpMi3MFam7wcGxTNR5vRFuAzSKn6FCS1oIEo3aFAbTHz15MDvUW027Q3OvweTGO5DSzYqmxZJdCRUDBFrsiWD77dKRmi/NInUya7pPrBEcOwt6yIcbfSKBv8"

string(29) "l love you! this is rsa test."

协议

996.icu LICENSE

MIT : license

rsa's People

Contributors

chuangyeshuo avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.