dev-fighters/php-crypter 问题修复 & 功能扩展

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

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

dev-fighters/php-crypter

最新稳定版本:1.0.8

Composer 安装命令:

composer require dev-fighters/php-crypter

包简介

Crypter for PHP

README 文档

README

Installation

  • Install with composer
    composer require dev-fighters/php-crypter
    
  • Requires PHP >= 8.2
  • Encryption algorithm is AEAD XChaCha20 Poly1305 IETF

How to use

Main file is \DF\Encryption\Crypter

  1. Generate a key : the key needs to be saved, or you can't decrypt further.
    $key = Crypter::generateKey()
  1. Encrypt
    $key = **KEY_GENERATED**
    $text = **TEXT_TO_ENCRYPT**
    $crypter = new Crypter($key);
    $encryptedText = $crypter->encrypt($text);
  1. Decrypt
    $key = **KEY_GENERATED**
    $textEncrypted = **TEXT_TO_DECRYPT**
    $crypter = new Crypter($key);
    $encryptedText = $crypter->decrypt($textEncrypted);
  • Additional : check if a string is encrypted or not
    $key = **KEY_GENERATED**
    $text = **TEXT_TO_DECRYPT**
    $crypter = new Crypter($key);
    
    $crypter->isEncrypted($text);
    $crypter->isNotEncrypted($text);

All functions accessible

    static function generateKey() : string;
    
    function encrypt(string $textToEncrypt) : string;
    function decrypt(string $textEncrypted) : string;
    
    function isEncrypted(string $textEncrypted) : bool;
    function isNotEncrypted(string $textEncrypted) : bool;

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-17