Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jd-vx-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
Administrator
jd-vx-app
Commits
526e7290
Commit
526e7290
authored
Jul 07, 2022
by
lijiongliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件修改
parent
cd599f16
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
41 deletions
+0
-41
crypto-js.js
static/js/crypto-js.js
+0
-41
No files found.
static/js/crypto-js.js
deleted
100644 → 0
View file @
cd599f16
import
CryptoJS
from
"crypto-js"
;
import
$http
from
'@/common/zhouWei-request/requestConfig'
;
// import CryptoJS from "../../node_modules/crypto-js/crypto-js.js";//一般npm以后都是这个位置
let
KEY
=
'自己的key'
let
IV
=
''
;
//我感觉可以不写,反正我没有写(看你们需求)
let
tools
=
{
/*aes加密*/
setAES
(
str
)
{
const
data
=
CryptoJS
.
enc
.
Hex
.
parse
(
str
);
const
key
=
CryptoJS
.
enc
.
Hex
.
parse
(
KEY
);
const
iv
=
CryptoJS
.
enc
.
Hex
.
parse
(
IV
);
var
option
=
{
iv
:
iv
,
mode
:
CryptoJS
.
mode
[
'CBC'
],
//看需求变“CBC”
padding
:
CryptoJS
.
pad
[
'ZeroPadding'
]
//看需求变“ZeroPadding”
};
var
encrypted
=
CryptoJS
.
AES
.
encrypt
(
data
,
key
,
option
);
const
words
=
encrypted
.
ciphertext
;
var
hex
=
CryptoJS
.
enc
.
Hex
.
stringify
(
words
);
return
hex
},
/*aes解密*/
decryptAES
(
str
)
{
console
.
log
(
"str"
,
str
)
let
data
=
CryptoJS
.
enc
.
Hex
.
parse
(
str
);
const
key
=
CryptoJS
.
enc
.
Hex
.
parse
(
KEY
);
const
iv
=
CryptoJS
.
enc
.
Hex
.
parse
(
IV
);
var
option
=
{
iv
:
iv
,
mode
:
CryptoJS
.
mode
[
'CBC'
],
//看需求变“CBC”
padding
:
CryptoJS
.
pad
[
'ZeroPadding'
]
//看需求变“ZeroPadding”
};
data
=
CryptoJS
.
enc
.
Base64
.
stringify
(
data
);
const
words
=
CryptoJS
.
AES
.
decrypt
(
data
,
key
,
option
);
var
hex
=
CryptoJS
.
enc
.
Hex
.
stringify
(
words
);
return
hex
}
};
export
default
tools
;
\ No newline at end of file
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