mukto90/ncrypt 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mukto90/ncrypt

最新稳定版本:v1.0

Composer 安装命令:

composer require mukto90/ncrypt

包简介

A simple PHP class to encrypt a string and decrypt an encrypted string

README 文档

README

A simple PHP class to encrypt a string, and decrypt an encrypted string

Steps

Include the class

Option 1 (using Composer)

  • Add the following to your composer.json file-
{
    "require": {
        "mukto90/ncrypt": "dev-master"
    }
}
  • Run composer install command.
  • Include your autoloader file (if not already), like this-
include 'vendor/autoload.php';

Option 2

  • Copy class.ncrypt.php file from ncrypt/src/ directory to your project.
  • Include the class in your project file, like this-
include 'src/class.ncrypt.php';

Instantiate the class

$ncrypt = new mukto90\Ncrypt;

Configure (optional)

  • Optionally set secret key, secret IV and cipher
$ncrypt->set_secret_key( '^&-my-key-&^' );  // optional, but STRONGLY recommended
$ncrypt->set_secret_iv( '#@)-my-iv-#*$' );  // optional, but STRONGLY recommended
$ncrypt->set_cipher( 'AES-256-CBC' );       // optional

How to encrypt a plain text/string

  • Pass your string to encrypt() method-
$encrypted = $ncrypt->encrypt( 'Hello World!' ); // output: SFpQVWk0WjFxdW5lSGFXaUdWUEx3Zz09

How to decrypt an encrypted string

  • Pass the already encrypted string to decrypt() method-
$decrypted = $ncrypt->decrypt( 'SFpQVWk0WjFxdW5lSGFXaUdWUEx3Zz09' ); // output: Hello World!

Requirement (minimum)

  • PHP 5.3.0
  • php_openssl library needs to be enabled. See here

Author

Nazmul Ahsan

Discussion

Link

统计信息

  • 总下载量: 12.45k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 17
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 16
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2018-05-15