lleocastro / encryptor
加密值,如密码和简短消息
dev-master
2016-11-28 18:41 UTC
Requires
- php: >=5.5.0
Requires (Dev)
- phpunit/phpunit: 4.8.*
Suggests
- zendframework/zend-diactoros: 1.3.7
- zendframework/zend-escaper: 2.5.2
This package is not auto-updated.
Last update: 2024-09-28 19:58:18 UTC
README
"为我的框架 "Genniuz" 开发的模块,但完全独立于框架运行。
安装
建议使用 Composer 安装 Encryptor。
composer require lleocastro/encryptor
此套件包含三种类型的数据加密!
点击任何链接进入特定方法的文档。
1. 哈希生成器
107位哈希用于密码加密以及不需要检索其值的对象,如仅用于比较的哈希
//Construct the HashGenerator $hash = new HashGenerator(); //Data input $data = "Hello World!"; //Data Encrypted $encryptedData = $hash->encode($data); //Output: "kFMZV3TGpVTWpnVIZFMs9GTqZldOtGZzZlbGt2VsRWWX1WNO5kbohlSEpEaKRUQ0oUR1UkVUJlTSd0c6RlbwpUTVVTVaNDcQZVMrhHVpVzT"; //Hashs comparables $check = $hash->isEquals("Hello World!", $encryptedData); //Output: true;
2. 消息加密器
使用简单的疯狂计算和一点神秘性,使用对称密钥加密消息。仅在小型消息上进行了测试。
//Construct the SMCrypter $smCrypt = new SMCrypter(); //Data input $originalValue = "My EMAIL is 'leonardo_carvalho@outlook.com' and (10+5/2*7=0999) <><because yes. çÇ>"; //Generate symmetric key $key = $smCrypt->keyGenerator(); //Output: VE4zWXpOPT1RTjBr //Encrypted $encoded = $smCrypt->encode($key, $originalValue); /** * Output: 591047765 928789345 268658075 253306185 529640205 591047765 498936425 560343985 583371820 268658075 253306185 * 805974225 882733675 268658075 253306185 299361855 829002060 775270445 852029895 844353950 744566665 875057730 767594500 * 852029895 729214775 759918555 744566665 875057730 905761510 744566665 829002060 798298280 852029895 491260480 852029895 * 898085565 890409620 829002060 852029895 852029895 821326115 353093470 759918555 852029895 836678005 299361855 268658075 * 253306185 744566665 844353950 767594500 268658075 253306185 307037800 376121305 368445360 330065635 406825085 360769415 * 383797250 322389690 422176975 468232645 368445360 437528865 437528865 437528865 314713745 268658075 253306185 291685910 * 829002060 890409620 452880755 291685910 790622335 890409620 452880755 291685910 829002060 890409620 452880755 752242610 * 775270445 759918555 744566665 898085565 882733675 775270445 268658075 253306185 928789345 775270445 882733675 353093470 * 268658075 253306185 291685910 759918555 759918555 775270445 767594500 805974225 829002060 452880755 291685910 514288315 * 759918555 775270445 767594500 805974225 829002060 452880755 291685910 790622335 890409620 452880755 */ //Decrypted $decoded = $smCrypt->decode($key, $encoded); //Output: "My EMAIL is 'leonardo_carvalho@outlook.com' and (10+5/2*7=0999) <><because yes. çÇ>";
3. 伪装
使用一些技巧和字符串处理在base64中加密和解密文本,使加密既神秘又简单
//Construct the Disguise $disguise = new Disguise(); //Data input $data = "This is a Rock ´N Roll.."; //Data Encrypted $encrypt = $disguise->obscure($data); //Output: "Mll2SkZJaEJ5Y3BCeWNwaEdWPT1nTHV3R2J2SkZJT1Jyd2dz"; //Decrypted $decrypt = $disguise->illumin($encrypt); //Output: "This is a Rock ´N Roll..";
了解更多
此 README 仅是一个预览,更多详细信息请参阅每个方法的 README。
安全
此代码是安全,可抵御跨站脚本(XSS)攻击。
如果您发现与安全相关的问题,请通过电子邮件 leonardo_carvalho@outlook.com 联系,而不是使用问题跟踪器。
对贡献
请参阅贡献文档。谢谢!
许可证
Encryptor 基于 MIT 许可证发布。有关更多信息,请参阅许可证文件。