当前位置:网站首页>随机生成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());
边栏推荐
- 说一说MVCC多版本并发控制器?
- When deleting a file, the prompt "the length of the source file name is greater than the length supported by the system" cannot be deleted. Solution
- How digitalization affects workflow automation
- 5. Data access - entityframework integration
- 高压漏电继电器BLD-20
- Paper reading [semantic tag enlarged xlnv model for video captioning]
- 漏电继电器JD1-100
- In memory, I moved from CSDN to blog park!
- 《5》 Table
- Digital innovation driven guide
猜你喜欢

Leetcode: maximum number of "balloons"

Leetcode 1189 maximum number of "balloons" [map] the leetcode road of heroding

CVE-2021-3156 漏洞复现笔记

K6EL-100漏电继电器

Dj-zbs2 leakage relay

K6el-100 leakage relay

一条 update 语句的生命经历
![Reading the paper [sensor enlarged egocentric video captioning with dynamic modal attention]](/img/db/feb719e2715c7b9c669957995e1d83.png)
Reading the paper [sensor enlarged egocentric video captioning with dynamic modal attention]

消息队列:消息积压如何处理?

SAP webservice 测试出现404 Not found Service cannot be reached
随机推荐
论文阅读【Semantic Tag Augmented XlanV Model for Video Captioning】
实现网页内容可编辑
Leakage relay jelr-250fg
Codeforces Round #416 (Div. 2) D. Vladik and Favorite Game
CentOS 7.9 installing Oracle 21C Adventures
JVM(十九) -- 字节码与类的加载(四) -- 再谈类的加载器
async / await
Taobao store release API interface (New), Taobao oauth2.0 store commodity API interface, Taobao commodity release API interface, Taobao commodity launch API interface, a complete set of launch store i
K6EL-100漏电继电器
K6el-100 leakage relay
Mapbox Chinese map address
EGR-20USCM接地故障继电器
High voltage leakage relay bld-20
Sorry, I've learned a lesson
Aidl and service
How can professional people find background music materials when doing we media video clips?
[JS component] date display.
How can project managers counter attack with NPDP certificates? Look here
Leetcode: maximum number of "balloons"
Flink SQL realizes reading and writing redis and dynamically generates hset key