From 20639ab03876d1bdb12cc752d4061b76e8876cfb Mon Sep 17 00:00:00 2001 From: yutent Date: Fri, 2 Jun 2023 18:53:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96uuid,=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=9C=89=E5=BA=8F=E7=89=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/index.mjs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 173b49e..e60a2fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "crypto.js", - "version": "3.1.0", + "version": "3.1.1", "description": "原生crypto加密模块的二次封装,简化常用加密函数的使用", "keywords": [ "md5", diff --git a/src/index.mjs b/src/index.mjs index 3a0343a..51fd11e 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -89,11 +89,12 @@ export function uuid(pipe = '-') { var str = origin.randomUUID() var now = (~~(Date.now() / 1000)).toString(16) - __inc__++ if (__inc__ > 65535) { __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) }