当前位置:网站首页>随机生成session_id
随机生成session_id
2022-07-06 23:45:00 【月来better】

// transformUint8ArrayToBase64
function transformUint8ArrayToBase64(array) {
var binary = "";
for (var len = array.byteLength, i = 0; i < len; i++) {
binary += String.fromCharCode(array[i]);
}
return window.btoa(binary).replace(/=/g, "");
}
function randomSessionId() {
let ua = new Uint8Array(20);
new DataView(ua.buffer).setUint32(0, Math.floor(+new Date() / 1000));
let crypto = window.crypto || window.msCrypto;
if (crypto) {
crypto.getRandomValues(ua.subarray(4, 20));
}
return (
"1." +
transformUint8ArrayToBase64(ua)
.replace(/\+/g, "-")
.replace(/\//g, "_")
);
}
console.log("随机生成session_id:", randomSessionId());
边栏推荐
- Unity keeps the camera behind and above the player
- How can project managers counter attack with NPDP certificates? Look here
- 高压漏电继电器BLD-20
- Flink SQL realizes reading and writing redis and dynamically generates hset key
- 分布式事务解决方案之2PC
- The year of the tiger is coming. Come and make a wish. I heard that the wish will come true
- Summary of the mean value theorem of higher numbers
- 利用OPNET进行网络指定源组播(SSM)仿真的设计、配置及注意点
- Taobao Commodity details page API interface, Taobao Commodity List API interface, Taobao Commodity sales API interface, Taobao app details API interface, Taobao details API interface
- Paper reading [open book video captioning with retrieve copy generate network]
猜你喜欢

CentOS 7.9 installing Oracle 21C Adventures

Dj-zbs2 leakage relay

Preliminary practice of niuke.com (9)

English语法_名词 - 所有格

Two person game based on bevy game engine and FPGA

How digitalization affects workflow automation

Record a pressure measurement experience summary

利用OPNET进行网络单播(一服务器多客户端)仿真的设计、配置及注意点

Safe landing practice of software supply chain under salesforce containerized ISV scenario

《2》 Label
随机推荐
[binary tree] binary tree path finding
消息队列:消息积压如何处理?
K6el-100 leakage relay
JHOK-ZBG2漏电继电器
利用OPNET进行网络单播(一服务器多客户端)仿真的设计、配置及注意点
漏电继电器JELR-250FG
JHOK-ZBL1漏电继电器
说一说MVCC多版本并发控制器?
The year of the tiger is coming. Come and make a wish. I heard that the wish will come true
5. Data access - entityframework integration
架构设计的五个核心要素
Dj-zbs2 leakage relay
分布式事务解决方案之TCC
Two person game based on bevy game engine and FPGA
Photo selector collectionview
论文阅读【Sensor-Augmented Egocentric-Video Captioning with Dynamic Modal Attention】
Tablayout modification of customized tab title does not take effect
English grammar_ Noun possessive
C#可空类型
导航栏根据路由变换颜色