-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yangyongxin
committed
Jul 23, 2020
0 parents
commit fdf5241
Showing
1,981 changed files
with
208,304 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "node js", | ||
"type": "shell", | ||
"command": "G:\\nodejs\\node.exe", | ||
"problemMatcher": [], | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const CryptoJS = require("crypto-js"); | ||
|
||
// let value = '123456';//待加密字符串加密 | ||
// let secrt_value = 'af25-87hk-a35v-5';//秘钥16位 | ||
// let iv_value = 'af25-87hk-a35v-5';//初始向量 initial vector 16 位 | ||
|
||
var e = "2F9fs3z84c36a8d1"; | ||
var t = "DnEL5EDzhqWqceY9"; | ||
let secret = CryptoJS.enc.Utf8.parse(e); | ||
let iv = CryptoJS.enc.Utf8.parse(t); | ||
// var n = { | ||
// param1: "9f035a29fafc97fc505493767045c0fd", | ||
// param2: "d8fd769a9359e2802d1b3da8660de66a", | ||
// param3: "6e516341bff63ebf45bbb77c9eeec83a", | ||
// param4: "a0c33f7f58fb0ff7647b0ed0adc9c2ef" | ||
// } | ||
|
||
var n = {"param1":"f49bb3debbc3db1dcbf8b2411e62c30c","param2":"4e869cc2acdf90210d465818508b6afb","param3":"02f2cd926b0dd9974e8dba52b03c12bb","param4":"72b2864d4dcc4fd1fe5f8fd7c3e50087"} | ||
|
||
var n2 = JSON.stringify(n) | ||
console.log(n2); | ||
|
||
let value = CryptoJS.enc.Utf8.parse(n2); | ||
|
||
//加密 | ||
let encryted = CryptoJS.AES.encrypt(value,secret,{ | ||
iv :iv, | ||
//mode 支持 CBC、CFB、CTR、ECB、OFB,默认CBC | ||
mode: CryptoJS.mode.CBC, | ||
//NoPadding 、ZeroPadding, 默认 PKcs7 即PKcs5 | ||
padding :CryptoJS.pad.Pkcs7 | ||
}); | ||
// 将加密结果转换为字符串 | ||
encryted = encryted.ciphertext.toString(); | ||
console.log(encryted); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
const CryptoJS = require("crypto-js"); | ||
|
||
// let value = '123456';//待加密字符串加密 | ||
// let secrt_value = 'af25-87hk-a35v-5';//秘钥16位 | ||
// let iv_value = 'af25-87hk-a35v-5';//初始向量 initial vector 16 位 | ||
function get_token(toke_params){ | ||
var e = "2F9fs3z84c36a8d1"; | ||
var t = "DnEL5EDzhqWqceY9"; | ||
let secret = CryptoJS.enc.Utf8.parse(e); | ||
let iv = CryptoJS.enc.Utf8.parse(t); | ||
|
||
var n = { | ||
param1: toke_params["param1"], | ||
param2: toke_params["param2"], | ||
param3: toke_params["param3"], | ||
param4: toke_params["param4"] | ||
} | ||
var n2 = JSON.stringify(n) | ||
|
||
let value = CryptoJS.enc.Utf8.parse(n2); | ||
|
||
//加密 | ||
let encryted = CryptoJS.AES.encrypt(value,secret,{ | ||
iv :iv, | ||
//mode 支持 CBC、CFB、CTR、ECB、OFB,默认CBC | ||
mode: CryptoJS.mode.CBC, | ||
//NoPadding 、ZeroPadding, 默认 PKcs7 即PKcs5 | ||
padding :CryptoJS.pad.Pkcs7 | ||
}); | ||
// 将加密结果转换为字符串 | ||
token = encryted.ciphertext.toString(); | ||
// console.log(encryted); | ||
return token | ||
} | ||
|
||
exports.getToken = get_token; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const express = require("express"); | ||
const app = express(); // express实例化 | ||
// 监听端口,设置回调 | ||
app.listen(3004,()=>{ | ||
console.log("server start"); | ||
}); | ||
|
||
|
||
const {getToken} = require('./get_token_args');// 导入模块 | ||
const bodyParser = require("body-parser");// 插件 | ||
//app.use 使用中间件(插件) | ||
app.use(bodyParser.urlencoded({extend:false})); | ||
//设置一个post接口 | ||
app.post('/token/qie',(req,res)=>{ | ||
// let {args} = req.body; | ||
// console.log(req.body); | ||
if(req.body){ | ||
res.send({error_code:-1,msg:getToken(req.body)}); | ||
}else{ | ||
res.send({error_code:0,msg:"请传递参数"}); | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
var str = {"name":"菜鸟教程", "site":"http:https://www.runoob.com"} | ||
var n = { | ||
param1: "9f035a29fafc97fc505493767045c0fd", | ||
param2: "d8fd769a9359e2802d1b3da8660de66a", | ||
param3: "6e516341bff63ebf45bbb77c9eeec83a", | ||
param4: "a0c33f7f58fb0ff7647b0ed0adc9c2ef" | ||
} | ||
str_pretty1 = JSON.stringify(n); | ||
console.log(str_pretty1); | ||
|
||
|
||
var dic = new Array(); //定义一个字典 | ||
|
||
dic['one'] = '1'; // 添加字典的元素( key:value) | ||
dic['three'] = '3'; | ||
dic['two'] = '2'; | ||
dic['8'] = 'seven'; | ||
dic['five'] = '5'; | ||
dic['four'] = '4'; | ||
dic['9'] = 'nine'; | ||
dic['six'] = '6'; | ||
dic['7'] = 'eight'; | ||
|
||
console.log(dic["7"]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
const CryptoJS = require("crypto-js"); | ||
|
||
|
||
function decode_args(take_params){ | ||
/** | ||
// let value = '2541';//待加密字符串加密 | ||
// let secrt_value = 'c451852f721ba85b8176387aec11bca4';//秘钥16位 | ||
// let iv_value = 'c451852f721ba85b8176387aec11bca4';//初始向量 initial vector 16 位 | ||
//秘钥和向量处理 | ||
let secret = CryptoJS.enc.Hex.parse(secrt_value); | ||
let iv = CryptoJS.enc.Hex.parse(iv_value); | ||
console.log(iv); | ||
console.log(iv.toString()); | ||
//加密 | ||
let encryted = CryptoJS.AES.encrypt(value,secret,{ | ||
iv :iv, | ||
//mode 支持 CBC、CFB、CTR、ECB、OFB,默认CBC | ||
mode: CryptoJS.mode.CBC, | ||
//NoPadding 、ZeroPadding, 默认 PKcs7 即PKcs5 | ||
padding :CryptoJS.pad.Pkcs7 | ||
}); | ||
// 将加密结果转换为字符串 | ||
encryted = encryted.toString(); | ||
*/ | ||
var data = take_params["datas"] | ||
var logid = take_params["logid"] | ||
var seed = take_params["seed"] | ||
var sss = logid + seed + logid | ||
var key = CryptoJS.MD5(sss).toString(); | ||
|
||
let secrt_value = key;//秘钥16位 | ||
let iv_value = key;//初始向量 initial vector 16 位 | ||
let encryted = data; | ||
|
||
let secret = CryptoJS.enc.Hex.parse(secrt_value); | ||
let iv = CryptoJS.enc.Hex.parse(iv_value); | ||
//解密,传入密文、秘钥和向量并设置加密与填充模式 | ||
let decrypted = CryptoJS.AES.decrypt(encryted,secret,{ | ||
iv :iv, | ||
//mode 支持 CBC、CFB、CTR、ECB、OFB,默认CBC | ||
mode: CryptoJS.mode.CBC, | ||
//NoPadding 、ZeroPadding, 默认 PKcs7 即PKcs5 | ||
padding :CryptoJS.pad.Pkcs7 | ||
}); | ||
|
||
//将解密结果转换为utf8字符串 | ||
decrypted = CryptoJS.enc.Utf8.stringify(decrypted); | ||
/* | ||
打印明文、密文和解密结果 | ||
xLilCRGWQ/CGqBUVya+4LQ== | ||
123456 | ||
*/ | ||
return decrypted | ||
} | ||
|
||
// var data = "N20r0z+sOYbAaVkZ9DM+Ng==" | ||
|
||
// console.log(decode_args(data, "seed", "logid")); | ||
|
||
|
||
exports.decryptArgs = decode_args; |
Oops, something went wrong.