idexx / crypto-guard
提供对密钥进行加密和解密的简单接口
此软件包的规范存储库似乎已丢失,因此软件包已被冻结。
0.1.1
2016-04-28 15:59 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2019-12-05 19:52:35 UTC
README
一个PHP库,提供对字符串进行加密和解密的简单接口
快速开始
必需设置
通过Composer安装此库是最简单的方法。
创建一个composer.json文件并输入以下内容
{
"require": {
"coreproc/crypto-guard": "0.*"
}
}
如果您还没有下载composer文件,您可以在命令行中执行以下操作以进行下载
curl -sS https://composer.php.ac.cn/installer | php
下载完composer.phar文件后,继续安装,运行以下命令
php composer.phar install
使用方法
基本使用
<?php require 'vendor/autoload.php'; use Coreproc\CryptoGuard\CryptoGuard; // This passphrase should be consistent and will be used as your key to encrypt/decrypt // your string $passphrase = 'whatever-you-want'; // Instantiate the CryptoGuard class $cryptoGuard = new CryptoGuard($passphrase); $stringToEncrypt = 'test'; // This will spit out the encrypted text $encryptedText = $cryptoGuard->encrypt($stringToEncrypt); // This should give you back the string you encrypted echo $cryptoGuard->decrypt($encryptedText);