From 00026e9b8b713b48c8602b8bc27e86b74d6cc564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Mon, 17 Jun 2019 17:18:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 5 ++--- package.json | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 61dbb95..4ebd775 100644 --- a/index.js +++ b/index.js @@ -109,18 +109,17 @@ module.exports = { let max = str.length let tmp = '' for (let i = 0; i < len; i++) { - let r = Math.floor(Math.random() * max) + let r = (Math.random() * max) >> 0 tmp += str[r] } return tmp }, // 返回一个如下格式的 xxxxxxxx-xxxx-xxxx-xxxxxxxx 的唯一ID - uuid(line = true) { + uuid(pipe = '-') { let rand = CRYPTO.randomBytes(8).toString('hex') let now = (Date.now() / 1000).toString(16).slice(0, 8) - let pipe = line ? '-' : '' if (this.__stamp__ === now) { this.__inc__++ } else { diff --git a/package.json b/package.json index ef59383..50bcb33 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "crypto.js", - "version": "1.3.0", + "version": "1.3.1", "description": "原生crypto加密模块的二次封装,简化常用加密函数的使用", "keywords": ["md5", "sha1", "base64", "fivejs", "crypto"], "author": "yutent ",