1. 程式人生 > >postman加密和使用當前時間戳

postman加密和使用當前時間戳

// 獲取全域性變數 uid = postman.getGlobalVariable(“uid”) sid = postman.getGlobalVariable(“sid”)

//設定當前時間戳 postman.setGlobalVariable(“time”,Math.round(new Date().getTime())); time = postman.getGlobalVariable(‘time’)

//設定KEY_WORD為全域性變數 postman.setGlobalVariable(“Key”,"******") KEY_WORD = postman.getGlobalVariable(“Key”);

//字串進行md5加密 var str = uid+sid+time+KEY_WORD; var strmd5= CryptoJS.MD5(str).toString(); postman.setGlobalVariable(“sign”,strmd5)