优化uuid, 增加有序特性
parent
5281159c21
commit
20639ab038
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "crypto.js",
|
"name": "crypto.js",
|
||||||
"version": "3.1.0",
|
"version": "3.1.1",
|
||||||
"description": "原生crypto加密模块的二次封装,简化常用加密函数的使用",
|
"description": "原生crypto加密模块的二次封装,简化常用加密函数的使用",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"md5",
|
"md5",
|
||||||
|
|
|
@ -89,11 +89,12 @@ export function uuid(pipe = '-') {
|
||||||
var str = origin.randomUUID()
|
var str = origin.randomUUID()
|
||||||
var now = (~~(Date.now() / 1000)).toString(16)
|
var now = (~~(Date.now() / 1000)).toString(16)
|
||||||
|
|
||||||
__inc__++
|
|
||||||
if (__inc__ > 65535) {
|
if (__inc__ > 65535) {
|
||||||
__inc__ = 1
|
__inc__ = 1
|
||||||
}
|
}
|
||||||
str += __inc__.toString(16)
|
|
||||||
|
str = __inc__.toString(16) + str
|
||||||
|
__inc__++
|
||||||
|
|
||||||
return now + pipe + MAC + pipe + str.slice(0, 4) + pipe + str.slice(-8)
|
return now + pipe + MAC + pipe + str.slice(0, 4) + pipe + str.slice(-8)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue