Genera UUID v4 crittograficamente sicuri β singoli o in bulk. 100% localeGenerate cryptographically secure UUID v4 β single or in bulk. 100% local
Un UUID (Universally Unique Identifier) Γ¨ un identificatore a 128 bit nel formato xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx. La versione 4 Γ¨ generata con numeri casuali crittograficamente sicuri β la probabilitΓ di collisione tra due UUID v4 Γ¨ astronomicamente bassa.
Gli UUID sono usati come chiavi primarie in database, document ID in Firestore (anche se Firebase preferisce push() o doc() auto-ID), session token, e ovunque serva un ID univoco senza coordinamento centrale.
A UUID (Universally Unique Identifier) is a 128-bit identifier in the format xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx. Version 4 is generated with cryptographically secure random numbers β the collision probability between two UUID v4 is astronomically low.
UUIDs are used as primary keys in databases, document IDs in Firestore (although Firebase prefers push() or doc() auto-IDs), session tokens, and anywhere you need a unique ID without central coordination.
UUID o Firebase auto-ID β quale usare con Firestore?UUID or Firebase auto-ID β which to use with Firestore?
Firebase genera automaticamente ID casuali sicuri con db.collection('items').doc() β sono ottimizzati per evitare hotspot nelle query. Gli UUID sono preferibili quando hai bisogno di generare l'ID lato client prima di scrivere il documento, o quando devi integrare con sistemi esterni.Firebase automatically generates secure random IDs with db.collection('items').doc() β they're optimized to avoid query hotspots. UUIDs are preferable when you need to generate the ID client-side before writing the document, or when integrating with external systems.
Come generare un UUID in JavaScript senza librerie?How do I generate a UUID in JavaScript without libraries?
Con Web Crypto API: crypto.randomUUID() β disponibile nei browser moderni e in Node.js 14.17+. In alternativa: ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,c=>(c^crypto.getRandomValues(new Uint8Array(1))[0]&15>>c/4).toString(16)).With the Web Crypto API: crypto.randomUUID() β available in modern browsers and Node.js 14.17+. Alternatively: ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,c=>(c^crypto.getRandomValues(new Uint8Array(1))[0]&15>>c/4).toString(16)).