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
- Generate a key : the key needs to be saved, or you can't decrypt further.
$key = Crypter::generateKey()
- Encrypt
$key = **KEY_GENERATED** $text = **TEXT_TO_ENCRYPT** $crypter = new Crypter($key); $encryptedText = $crypter->encrypt($text);
- 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
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-17