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 ",