master 1.3.1
宇天 2019-06-17 17:18:41 +08:00
parent 704a806e49
commit 00026e9b8b
2 changed files with 3 additions and 4 deletions

View File

@ -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 {

View File

@ -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 <yutent@doui.cc>",