Skip to content

Commit

Permalink
把strategy文件夹名恢复成adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
cmpan committed Sep 7, 2017
1 parent 8409eca commit 2b54e79
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ $key = '秘钥';
$txt = '明文~';
// 1、使用AzDG算法加密解密
$crypt = new \wf\crypt\strategy\AzDG();
$crypt = new \wf\crypt\adapter\AzDG();
$enc = $crypt->encrypt($txt, $key); // 加密
$dec = $crypt->decrypt($enc, $key); // 解密
// 2、使用Xxtea算法加密解密
$crypt = \wf\crypt\strategy\Xxtea();
$crypt = \wf\crypt\adapter\Xxtea();
$enc = $crypt->encrypt($txt, $key); // 加密
$dec = $crypt->decrypt($enc, $key); // 解密
// 3、通过配置文件选择使用加密方式
$cfg = [
'class' => '\\wf\\crypt\\strategy\\AzDG',
'class' => '\\wf\\crypt\\adapter\\AzDG',
'key' => 'value',
];
$crypt = $cfg['class']($cfg);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"XXTea",
"AzDG"
],
"version" : "1.0.4",
"version" : "1.1.0",
"time" : "2017-06-26 16:30:00",
"require" : {
"php" : ">=5.5.0"
Expand Down
4 changes: 2 additions & 2 deletions lib/strategy/AzDG.php → lib/adapter/AzDG.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
* @copyright Copyright (c) 2008-2017 Windwork Team. (http://www.windwork.org)
* @license http://opensource.org/licenses/MIT
*/
namespace wf\crypt\strategy;
namespace wf\crypt\adapter;

/**
* 可逆对称加密解密
* 极高效的对称加密算法
* 参考Discuz! Passport采用的Azerbaijan Development Group(AzDG)开发的可逆加密算法
*
* @package wf.crypt.strategy
* @package wf.crypt.adapter
* @author cm <[email protected]>
* @link http://docs.windwork.org/manual/wf.crypt.html
* @since 0.1.0
Expand Down
4 changes: 2 additions & 2 deletions lib/strategy/Xxtea.php → lib/adapter/Xxtea.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @copyright Copyright (c) 2008-2017 Windwork Team. (http://www.windwork.org)
* @license http://opensource.org/licenses/MIT
*/
namespace wf\crypt\strategy;
namespace wf\crypt\adapter;

/**
* 基于xxtea加密算法实现
Expand All @@ -19,7 +19,7 @@
* 参考源码:
* Ma Bingyao <[email protected]> (https://github.com/xxtea/xxtea-php)
*
* @package wf.crypt.strategy
* @package wf.crypt.adapter
* @author cm <[email protected]>
* @link http://docs.windwork.org/manual/wf.crypt.html
* @since 0.1.0
Expand Down
6 changes: 3 additions & 3 deletions test/AzDGTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
require_once '../lib/CryptInterface.php';
require_once '../lib/strategy/AzDG.php';
require_once '../lib/adapter/AzDG.php';

use \wf\crypt\strategy\AzDG;
use \wf\crypt\adapter\AzDG;

/**
* AzDG test case.
Expand Down Expand Up @@ -61,7 +61,7 @@ public function testEncrypt()
*/
public function testDecrypt()
{
$crypt = new \wf\crypt\strategy\AzDG();
$crypt = new \wf\crypt\adapter\AzDG();

$key = 'ssdsdsfdswe';
$txt = 'ojdsfojdsfo 交水电费 ds ds!';
Expand Down
6 changes: 3 additions & 3 deletions test/XxteaTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
require_once '../lib/CryptInterface.php';
require_once '../lib/strategy/Xxtea.php';
require_once '../lib/adapter/Xxtea.php';

use \wf\crypt\strategy\Xxtea;
use \wf\crypt\adapter\Xxtea;

/**
* Xxtea test case.
Expand Down Expand Up @@ -65,7 +65,7 @@ public function testEncrypt()
*/
public function testDecrypt()
{
$crypt = new \wf\crypt\strategy\Xxtea('Xxtea');
$crypt = new \wf\crypt\adapter\Xxtea('Xxtea');

$key = 'ssdsdsfdswe';
$txt = 'ojdsfojdsfo 交水电费 d水电费 d水电费 d水电费 d水电费 d水电费 ds ds!';
Expand Down

0 comments on commit 2b54e79

Please sign in to comment.