tuhin18003/simpler-php-encrypt-decrypt 问题修复 & 功能扩展

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

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

tuhin18003/simpler-php-encrypt-decrypt

最新稳定版本:v1.0.1

Composer 安装命令:

composer require tuhin18003/simpler-php-encrypt-decrypt

包简介

Very handy and simpler PHP Encryption and Decryption

README 文档

README

Very handy and simpler PHP Encryption and Decryption

Install

Via Composer

$ composer require tuhin18003/simpler-php-encrypt-decrypt

Usage

Include the autoload file in your working file..

require './vendor/autoload.php';

Encryption

use Tuhin18003\SimPhpEnDecrypt\Builder;

$encryption = Builder::encrypt('test');

Output

It returns an array with cipher and key

Array ( [cipher] => SWlPb2ZQN1ZDRlJXb2JwRXdOVmtmZz09 [key] => MTk2OGEyOTdlE0M2RkMjhkZGRlOTQxMTk= )

Decryption

use Tuhin18003\SimPhpEnDecrypt\Builder;

Builder::decrypt( $encryption['cipher'], $encryption['key'] );

Output

It returns the original string

test

Production - Different approach

Get the encrypted and decrypted string without handling the Cipher and Key

Encryption

You can use your own joiner in advance or leave the second parameter of the function blank. This will make your string more secure.

use Tuhin18003\SimPhpEnDecrypt\Builder;

$encryptedToken = Builder::getEncryptedToken('test', "__");

Without joiner:

use Tuhin18003\SimPhpEnDecrypt\Builder;

$encryption = Builder::getEncryptedToken('test');

Output

It returns a encrypted token

aDhaRFZjK2Z1WWlQa1NkSnRINXJMaE85TnhBT2tTQWxTaDJ1eHdmeVl3MD0=__MjkyMjA4MzBhYWZkY2YyNjYyYzU0YWQ2Y2VkMjJkZjI0YTcyMGFjM2QxMDdhZTc3NzA2MGFjOGRhZDA3MTc0OV9fX2Q2NzEwNzc0OWE0MmU4NDI=

Decryption

if you have used your custom joiner, please use it here again

use Tuhin18003\SimPhpEnDecrypt\Builder;

Builder::getDecryptedToken( $encryptedToken, "__");

Or keep blank the second parameter

use Tuhin18003\SimPhpEnDecrypt\Builder;

Builder::getDecryptedToken( $encryptedToken );

Output

It returns the original string

test

Credentials

codesolz.net

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固