![]() You will want a Random-based UUID, which is 4. According to this article in plain js I may create an uuid via crypto. The paper is not so technical, I suggest reading it: /html/rfc4122 Generating UUID in react using crypto api Ask Question 2 According to MDM ( ) Most modern Browsers support the javascript native crypto api, which supports the former node-js crypto standard. If you have a counter and only 1 machine generating it, you will not need anything else anyway. You do not need a counter, as the 100s-nanoseconds interval and a good random number should be enough to avoid a collision. ), and the UUID uses something from the localhost (a mac address for instance). ![]() Other tools like databases use it too (like MongoDB)īeside your parameters (time and random number), you need another one, to avoid collision between 2 separate instances that reach the same random at the same time (I know that is far fetched. package/uuid seems to respect the standard. It can generate version 1, 3, 4 and 5 UUIDs. You do not need to invent a new one, just read the specs or use the npm package: The JavaScript library we recommend for generating UUIDs is called (unsurprisingly), uuid. UUID is pretty standard, and already has 5 version of algorithms. uuid.v1 ( options, buffer, offset) Create an RFC version 1 (timestamp) UUID Note: The default node id (the last 12 digits in the UUID) is generated once, randomly, on process startup, and then remains unchanged for the duration of the process.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |