aufa/encryption

另一个加密工具

1.0 2016-08-12 12:37 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:21:25 UTC


README

另一个加密助手

Build Status

将字符串或另一种类型的值加密。默认情况下,加密使用 mcrypt 与:MCRYPT_RIJNDAEL_256 + MCRYPT_MODE_ECB,另一种加密则使用 str_rot13 的替代方案,并通过 base64_encode 进行编码。

加密

/**
 * Using default encryption mcrypt
 */
Aufa\Encryption\Encryption::encrypt('string to encrypt', 'saltkey');

/**
 * Using alternative type
 */
Aufa\Encryption\Encryption::altEncrypt('string to encrypt', 'saltkey');

解密

/**
 * Decrypt encrypted string with auto detect encryption use
 */
Aufa\Encryption\Encryption::decrypt('string to decrypt', 'saltkey');

// or can use
Aufa\Encryption\Encryption::altDecrypt('string to decrypt', 'saltkey');

使用 Composer 安装

Composer 是一个方便的工具,可以从 Packagist 和其他资源轻松添加库到您的应用程序。获取安装方法请访问: https://composer.php.ac.cn 并在您的操作系统上安装。

{
  "require": {
        "aufa/encryption" : "~1"
  }
}

需求

此库需要 php 5.3.2 或更高版本。建议在您的 php 配置中启用 mcrypt

许可证

GPLv3 或更高版本 https://gnu.ac.cn/licenses/gpl-3.0.txt