Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gaohuaxue-mobile-app
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵振东
gaohuaxue-mobile-app
Commits
c28dbdf9
Commit
c28dbdf9
authored
Nov 23, 2022
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 搬运cryptoAes
parent
cce1f4a6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
cryptoAes.ts
src/utils/cryptoAes.ts
+23
-0
No files found.
src/utils/cryptoAes.ts
0 → 100644
View file @
c28dbdf9
import
CryptoJS
from
'crypto-es'
;
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'GzSsyLingxi2.0.0'
);
/**
* @auth xjm
* 加密方法
*/
export
const
encryptedByAES
=
(
source
:
string
)
=>
{
const
password
=
CryptoJS
.
enc
.
Utf8
.
parse
(
source
);
// @ts-ignore
const
encrypted
=
CryptoJS
.
AES
.
encrypt
(
password
,
key
,
{
mode
:
CryptoJS
.
mode
.
ECB
,
padding
:
CryptoJS
.
pad
.
Pkcs7
})
// CryptoJS.pad.Pkcs7
return
encrypted
.
toString
()
// 加密后的base64
}
/**
* @auth xjm
* 解密方法
*/
export
const
decryptedByAES
=
(
source
:
string
)
=>
{
// @ts-ignore
const
decrypted
=
CryptoJS
.
AES
.
decrypt
(
source
,
key
,
{
mode
:
CryptoJS
.
mode
.
ECB
,
padding
:
CryptoJS
.
pad
.
Pkcs7
});
// CryptoJS.pad.Pkcs7
return
decrypted
.
toString
(
CryptoJS
.
enc
.
Utf8
)
// 解密后的原始字符串
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment