当前位置:网站首页>随机生成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());
边栏推荐
- JVM (19) -- bytecode and class loading (4) -- talk about class loader again
- 删除文件时提示‘源文件名长度大于系统支持的长度’无法删除解决办法
- 阿里云的神龙架构是怎么工作的 | 科普图解
- Dj-zbs2 leakage relay
- 拼多多新店如何获取免费流量,需要从哪些环节去优化,才能有效提升店内免费流量
- 论文阅读【Semantic Tag Augmented XlanV Model for Video Captioning】
- 4. Object mapping Mapster
- Leetcode: maximum number of "balloons"
- 4. 对象映射 - Mapping.Mapster
- Educational Codeforces Round 22 B. The Golden Age
猜你喜欢
Initial experience of annotation
漏电继电器LLJ-100FS
Leakage relay jelr-250fg
数字化如何影响工作流程自动化
Dj-zbs2 leakage relay
How Alibaba cloud's DPCA architecture works | popular science diagram
利用OPNET进行网络指定源组播(SSM)仿真的设计、配置及注意点
Mapbox Chinese map address
[reading of the paper] a multi branch hybrid transformer network for channel terminal cell segmentation
张平安:加快云上数字创新,共建产业智慧生态
随机推荐
1.AVL树:左右旋-bite
【js组件】date日期显示。
4. 对象映射 - Mapping.Mapster
Initial experience of annotation
LabVIEW is opening a new reference, indicating that the memory is full
淘寶商品詳情頁API接口、淘寶商品列錶API接口,淘寶商品銷量API接口,淘寶APP詳情API接口,淘寶詳情API接口
JHOK-ZBL1漏电继电器
The navigation bar changes colors according to the route
[论文阅读] A Multi-branch Hybrid Transformer Network for Corneal Endothelial Cell Segmentation
How can project managers counter attack with NPDP certificates? Look here
阿里云的神龙架构是怎么工作的 | 科普图解
Use, configuration and points for attention of network layer protocol (taking QoS as an example) when using OPNET for network simulation
DOM-节点对象+时间节点 综合案例
Unity让摄像机一直跟随在玩家后上方
漏电继电器JELR-250FG
Vector and class copy constructors
nodejs获取客户端ip
论文阅读【MM21 Pre-training for Video Understanding Challenge:Video Captioning with Pretraining Techniqu】
Life experience of an update statement
How digitalization affects workflow automation