Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
周少峰
9 years ago
Commit
c43b3a3bc9bbf9e3ddbd5501ff8b2bc395e90e96
1 parent
eb77cb07
encreyption less 8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
library/WebPlugin/Encryption.php
library/WebPlugin/Encryption.php
View file @
c43b3a3
...
...
@@ -10,12 +10,16 @@ class Encryption {
//密钥
private
static
$_secrect_key
=
'yoho9646abcdefgh'
;
//前面补8位0
private
static
$_preString
=
'00000000'
;
/**
* 加密方法
* @param string $str
* @return string
*/
public
static
function
encrypt
(
$str
){
$str
=
self
::
$_preString
.
$str
;
//AES, 128 ECB模式加密数据
$screct_key
=
self
::
$_secrect_key
;
$str
=
trim
(
$str
);
...
...
@@ -38,6 +42,7 @@ class Encryption {
$encrypt_str
=
mcrypt_decrypt
(
MCRYPT_RIJNDAEL_128
,
$screct_key
,
$str
,
MCRYPT_MODE_ECB
,
$iv
);
$encrypt_str
=
trim
(
$encrypt_str
);
$encrypt_str
=
self
::
stripPKSC7Padding
(
$encrypt_str
);
$encrypt_str
=
ltrim
(
$encrypt_str
,
self
::
$_preString
);
return
$encrypt_str
;
}
...
...
Please
register
or
login
to post a comment