PHPackages                             wpfly/crypto - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. wpfly/crypto

ActiveLibrary[Security](/categories/security)

wpfly/crypto
============

常用加密解密库

4.0.1(4y ago)01311MITPHPPHP &gt;=5.4.0

Since Feb 1Pushed 4y ago1 watchersCompare

[ Source](https://github.com/flyering/crypto)[ Packagist](https://packagist.org/packages/wpfly/crypto)[ Docs](https://www.wpfly.cn/)[ RSS](/packages/wpfly-crypto/feed)WikiDiscussions master Synced today

READMEChangelog (10)DependenciesVersions (14)Used By (0)

crypt
=====

[](#crypt)

#### 介绍

[](#介绍)

常用加密/解密库，目前包括RSA加密/解密、整数加密/解密、AES加密/解密。

#### 安装方法

[](#安装方法)

$ composer require wpfly/crypto

#### 使用说明

[](#使用说明)

use wpfly\\Crypto;

//RSA加密、解密

//自带公钥私钥，以便“开箱即用”去试验。实际中使用，请【一定】【一定】【一定】重新设置密钥后再加密（参考sample/index.php中用例6）！

$crypto = new Crypto();

$s = '我真是个天才！';

$d1 = $crypto-&gt;privEncrypt($s);

$d2 = $crypto-&gt;pubDecrypt($d1);

$d3 = $crypto-&gt;pubEncrypt($s);

$d4 = $crypto-&gt;privDecrypt($d3);

var\_dump($s, $d1, $d2, $d3, $d4);

//数字加密、解密

$crypto = new Crypto();

$num = '12';

$key = 644;

$r1 = $crypto-&gt;numberEncrypt($num, $key, 10);

$r2 = $crypto-&gt;numberDecrypt($r1, $key);

var\_dump($num, $r1, $r2);

//输出结果：

//string(2) "12"

//string(10) "0707549034"

//string(10) "0000000012"

//AES加密、解密

$crypto = new Crypto();

$s = '我真是个天才！';

$d1 = $crypto-&gt;aesEncrypt($s, 'password5');

$d2 = $crypto-&gt;aesDecrypt($d1, 'password5');

var\_dump($s, $d1, $d2);

更多使用示例参看 sample/index.php

#### 参与贡献

[](#参与贡献)

1. Fork 本仓库
2. 新建 Feat\_xxx 分支
3. 提交代码
4. 新建 Pull Request

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~28 days

Recently: every ~59 days

Total

13

Last Release

1641d ago

Major Versions

1.0.1 → 2.0.02021-04-23

2.1.1 → 3.0.02021-05-09

3.3.1 → 4.0.02021-08-17

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23145499?v=4)[wangpf](/maintainers/wpfly)[@wpfly](https://github.com/wpfly)

---

Top Contributors

[![flyering](https://avatars.githubusercontent.com/u/18331066?v=4)](https://github.com/flyering "flyering (6 commits)")

---

Tags

rsaaesencryptdecryptnumberiddiffusion

### Embed Badge

![Health badge](/badges/wpfly-crypto/health.svg)

```
[![Health](https://phpackages.com/badges/wpfly-crypto/health.svg)](https://phpackages.com/packages/wpfly-crypto)
```

###  Alternatives

[phpseclib/phpseclib

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.

5.6k465.6M1.5k](/packages/phpseclib-phpseclib)[defuse/php-encryption

Secure PHP Encryption Library

3.9k175.2M254](/packages/defuse-php-encryption)[nzo/url-encryptor-bundle

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

971.1M2](/packages/nzo-url-encryptor-bundle)[miladrahimi/phpcrypt

Encryption, decryption, and hashing tools for PHP projects

3275.4k2](/packages/miladrahimi-phpcrypt)[xxtea/xxtea

XXTEA is a fast and secure encryption algorithm. This is a XXTEA library for PHP.

11343.0k](/packages/xxtea-xxtea)[hemiframe/php-aes

PHP class for encrypt and decrypt data with AES algorithm

1031.4k](/packages/hemiframe-php-aes)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
