Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
473da8ee
Commit
473da8ee
authored
Oct 15, 2020
by
Sxy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gsb-center-manage' of gitlab.gongsibao.com:jiangyong/zhichan into gsb-center-manage
parents
5bfb1a6b
5cfaa7e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
8 deletions
+41
-8
center-manage/app/base/test.js
+41
-8
No files found.
center-manage/app/base/test.js
View file @
473da8ee
const
CryptoJS
=
require
(
"crypto-js"
);
let
u
=
{
"id"
:
12
,
"nickName"
:
"好好学习"
,
"mobile"
:
"13381139519"
,
"isAdmin"
:
false
}
var
str
=
JSON
.
stringify
(
u
);
// 密钥 16 位
var
key
=
'dc35d3a0bd6641d891d3233b5286225a'
;
// 初始向量 initial vector 16 位
var
iv
=
'92bcc33e807d43fc8265ee5210e37923'
;
// key 和 iv 可以一致
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
key
);
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
iv
);
var
encrypted
=
CryptoJS
.
AES
.
encrypt
(
str
,
key
,
{
iv
:
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
});
// 转换为字符串
encrypted
=
encrypted
.
toString
();
console
.
log
(
"加密串"
,
encrypted
)
console
.
log
(
"加密串"
,
encodeURIComponent
(
encrypted
))
// mode 支持 CBC、CFB、CTR、ECB、OFB, 默认 CBC
// padding 支持 Pkcs7、AnsiX923、Iso10126
// NoPadding、ZeroPadding, 默认 Pkcs7, 即 Pkcs5
// 解密
var
decrypted
=
CryptoJS
.
AES
.
decrypt
(
encrypted
,
key
,
{
iv
:
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
});
decrypted
=
CryptoJS
.
enc
.
Utf8
.
stringify
(
decrypted
);
console
.
log
(
"解密串"
,
decrypted
)
// var a=[1,2]
// var a=[1,2]
// var b=[3,4]
// var b=[3,4]
...
@@ -54,7 +87,7 @@
...
@@ -54,7 +87,7 @@
// "add",
// "add",
// "edit",
// "edit",
// "delete",
// "delete",
// "export",
// "export",
// "show"],
// "show"],
// "seq":2,
// "seq":2,
...
@@ -75,7 +108,7 @@
...
@@ -75,7 +108,7 @@
// "add",
// "add",
// "edit",
// "edit",
// "delete",
// "delete",
// "export",
// "export",
// "show"],
// "show"],
// "seq":2,
// "seq":2,
...
@@ -99,7 +132,7 @@
...
@@ -99,7 +132,7 @@
// "add",
// "add",
// "edit",
// "edit",
// "delete",
// "delete",
// "export",
// "export",
// "show"],
// "show"],
// "seq":3,
// "seq":3,
...
@@ -114,7 +147,7 @@
...
@@ -114,7 +147,7 @@
// "add",
// "add",
// "edit",
// "edit",
// "delete",
// "delete",
// "export",
// "export",
// "show"],
// "show"],
// "seq":1,
// "seq":1,
...
@@ -135,7 +168,7 @@
...
@@ -135,7 +168,7 @@
// "add",
// "add",
// "edit",
// "edit",
// "delete",
// "delete",
// "export",
// "export",
// "show"],
// "show"],
// "seq":1,
// "seq":1,
...
@@ -159,7 +192,7 @@
...
@@ -159,7 +192,7 @@
// "add",
// "add",
// "edit",
// "edit",
// "delete",
// "delete",
// "export",
// "export",
// "show"],
// "show"],
// "seq":4,
// "seq":4,
...
@@ -174,7 +207,7 @@
...
@@ -174,7 +207,7 @@
// "add",
// "add",
// "edit",
// "edit",
// "delete",
// "delete",
// "export",
// "export",
// "show"],
// "show"],
// "seq":1,
// "seq":1,
...
@@ -195,7 +228,7 @@
...
@@ -195,7 +228,7 @@
// "add",
// "add",
// "edit",
// "edit",
// "delete",
// "delete",
// "export",
// "export",
// "show"],
// "show"],
// "seq":2,
// "seq":2,
...
...
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