URN - UUIDs (Universally Unique IDentifier) or GUIDs (Globally Unique IDentifier)

> (World Wide) Web - (W3|WWW) > (Web|Internet) - Resource

1 - About

UUIDs (Universally Unique IDentifier) or GUIDs (Globally Unique IDentifier) are identifier

A UUID is 128 bits long, and:

  • can guarantee uniqueness across space and time
  • requires no central registration process.

You can use UUIDs as URNs

Advertising

3 - Specification

4 - Implementation

4.1 - Javascript Code

From stackoverflow

function uuidv4() {
  return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
    (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
  );
}
 
console.log(uuidv4());

4.2 - Uuid package

https://www.npmjs.com/package/uuid

Example:

<script src="https://wzrd.in/standalone/uuid%[email protected]"></script>
console.log(uuidv4());

5 - Documentation / Reference