7id 中文文档教程
7ID
随机 base32(RFC 4648 无填充)字符串生成器用于唯一 ID 使用。
该库包含函数 generate()
, 它接受 crypto
在其函数 randomBytes()
上使用的字节数。
生成的字符和请求的字节长度的比例是 5/16 (0.3125)。 每 5 个字节,生成 16 个字符。 10字节输出是一个32个字符的字符串。
Collision probability
概率取决于通知的字节长度。
在碰撞的实际测试中,发生碰撞的基因是:
Generations |
---|
16690357 |
20813326 |
30091557 |
30288983 |
40839999 |
43867276 |
44935582 |
(…) |
Usage
Example
const thitySixID = require('7id')
let result = thitySixID.generate(6)
console.log(result)
Output example
'G42WCY3CMVSTOOLGGIYQ'
7ID
Random base32 (RFC 4648 without padding) string generator for unique ID usage.
This library includes the function generate()
, which accepts a number of bytes to be used by crypto
on it's function randomBytes()
.
The proportion of characters generated and the length of bytes requested is 5/16 (0.3125). Each 5 bytes, 16 characters are generated. 10 bytes output is a string of 32 characters.
Collision probability
The probability depends on the bytes length informed.
On a practical test of collision, the genetions that colided was:
Generations |
---|
16690357 |
20813326 |
30091557 |
30288983 |
40839999 |
43867276 |
44935582 |
(…) |
Usage
Example
const thitySixID = require('7id')
let result = thitySixID.generate(6)
console.log(result)
Output example
'G42WCY3CMVSTOOLGGIYQ'