PHPackages                             harlan-zh/php-mcrypt - 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. harlan-zh/php-mcrypt

ActiveLibrary[Security](/categories/security)

harlan-zh/php-mcrypt
====================

php-3des library

08PHP

Since Aug 9Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Harlan-zh/php-mcrypt)[ Packagist](https://packagist.org/packages/harlan-zh/php-mcrypt)[ RSS](/packages/harlan-zh-php-mcrypt/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

php-mcrypt - Library
====================

[](#php-mcrypt---library)

"PHP 3DES加密解密类库"

Use Composer Install
====================

[](#use-composer-install)

```
composer require harlan-zh/php-mcrypt
```

Usage:
======

[](#usage)

Example : (3Des Encrypt and Decrypt)

```
define('MCRYPT_ROOT', dirname(__FILE__));

// 包含自动加载文件
require MCRYPT_ROOT . "/autoload.php";

use Mcrypt\DesEncryptor;
use Mcrypt\StringPadding;
use Mcrypt\McryptException;

$key = "qwert!@#^*";
// $iv = "bibiblili";
$iv = "";
$str = 'ILoveMe';

try {
    // 实例化加密类
    $desEncryptor = new DesEncryptor($key, $iv);

    // 设置加密的参数
    $desEncryptor->setMode(MCRYPT_MODE_CBC);
    $desEncryptor->setPaddingMode(StringPadding::pkcs7Padding);

    // 将加密结果放在
    $encrypt = base64_encode($desEncryptor->encrypt3DES($str));
    $decrypt = $desEncryptor->decrypt3DES(base64_decode($encrypt));    $encrypt)); = $desEncryptor->decrypt3DES(base64_decode($encrypt));
} catch (McryptException $e) {
    print $e->getMcryptMsg();
    exit;
}

echo "原文：${str}" . PHP_EOL;     // 需要加密的字符串
echo "加密：${encrypt}" . PHP_EOL; // 加密结果
echo "解密：${decrypt}";           // 将加密字符转化明文

//result：
//    '原文：ILoveMe'
//    '加密：wMIpQDwfDXI='
//    '解密：ILoveMe'
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/447324b00f828e4e1ab67d948491e8a5457c127ce95f57dab1bfd4faa748da26?d=identicon)[Harlan-zh](/maintainers/Harlan-zh)

---

Top Contributors

[![JiaoFenHu](https://avatars.githubusercontent.com/u/53736226?v=4)](https://github.com/JiaoFenHu "JiaoFenHu (8 commits)")

### Embed Badge

![Health badge](/badges/harlan-zh-php-mcrypt/health.svg)

```
[![Health](https://phpackages.com/badges/harlan-zh-php-mcrypt/health.svg)](https://phpackages.com/packages/harlan-zh-php-mcrypt)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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