Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Commit

Permalink
Update TaiNine.php
Browse files Browse the repository at this point in the history
  • Loading branch information
shawroger authored Aug 29, 2019
1 parent 641ec6f commit 793e871
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions TaiNine.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,18 @@ function __construct() {
$this->originKey[$i]=$KEY[$i];
}

//每次打乱数组
shuffle($this->encryptKey);

//获取打乱数组的序列
for($i=0;$i<=80;$i++){
$encryMethod=$encryMethod.$this->encryptKey[$i];
}
$this->method=$encryMethod;

//获取正确序列数组的反序列
$this->underKey=array_flip($this->encryptKey);
$this->underKey=array_flip($this->originKey);

}


Expand All @@ -116,13 +126,6 @@ function backHtml($string) {
function encrypt($str){

$str=$this->toHtml($str);
//每次打乱数组
shuffle($this->encryptKey);

//获取打乱数组的序列
for($i=0;$i<=80;$i++){
$encryMethod=$encryMethod.$this->encryptKey[$i];
}

//打乱序列
for($i=0;$i<strlen($str);$i++){
Expand All @@ -131,12 +134,11 @@ function encrypt($str){
$encStr=$encStr.$this->encryptKey[$j];
}
$this->encryptData=$encStr;
$this->method=$encryMethod;

}

function decrypt($str,$method){
for($i=0;$i<strlen($method);$i++){
for($i=0;$i<=80;$i++){
$decryKey[$i]=$method[$i];
}
$underDecryKey=array_flip($decryKey);
Expand All @@ -152,5 +154,5 @@ function decrypt($str,$method){
}

//class end

}

0 comments on commit 793e871

Please sign in to comment.