हैश/क्रिप्टो
UUID Generator
वर्शन 1, 3, 4, 5, 6 और 7 UUID जनरेट करें — रैंडम, टाइम-बेस्ड और नाम-आधारित (name-based)।
A UUID (Universally Unique Identifier) is a 128-bit identifier that's unique in practice without a central registry: two independent servers can generate one at the same moment and almost never collide. The versions differ in how they're generated.
Which version to pick
- v4 — fully random, the most common choice for database record IDs, session keys, and similar cases.
- v1 and v6 — based on creation time; v6 carries the same content as v1 but with the fields reordered so it sorts naturally — handy as a primary key.
- v3 and v5 — deterministic, derived from a namespace and a name (v3 uses MD5, v5 uses SHA-1) — the same input always produces the same UUID.
- v7 — the newest standard: a millisecond Unix timestamp plus a random part, sortable by time like v1/v6, but without a MAC address.
Common uses
- Primary keys in databases where auto-increment doesn't fit (distributed systems, offline-first apps).
- Session IDs, request IDs for tracing, temporary file names.
- Deterministic IDs (v5) for objects that need the same identifier across different systems given the same name.
Things to keep in mind
UUID v1 and v6 embed the generating device's MAC address — avoid them if that's an unwanted disclosure.
The format is 32 hexadecimal characters grouped with hyphens as 8-4-4-4-12 (e.g. 550e8400-e29b-41d4-a716-446655440000).
इस टूल के बारे में लेख: UUID: ऐसे आइडेंटिफ़ायर कैसे बनते हैं जो लगभग कभी नहीं दोहराते
अक्सर पूछे जाने वाले प्रश्न
UUID v4 और अन्य वर्शन में क्या अंतर है?
UUID v4 रैंडम या स्यूडो-रैंडम संख्याओं से जनरेट होता है, जो इसे समय या हार्डवेयर आइडेंटिफ़ायर पर निर्भर हुए बिना सबसे सरल विकल्प बनाता है। अन्य वर्शन जैसे v1 टाइमस्टैम्प और MAC एड्रेस एन्कोड करते हैं, या v5 नेमस्पेस और नाम से निर्धारक रूप से UUID निकालता है।
दो जनरेट किए गए UUID के टकराने की संभावना कितनी है?
बेहद कम। एक v4 UUID में 122 रैंडम बिट्स होते हैं, इसलिए टकराव सांख्यिकीय रूप से संभावित होने से पहले सदियों तक प्रति सेकंड अरबों UUID जनरेट करने पड़ेंगे।
क्या यहां जनरेट किए गए UUID कहीं भेजे जाते हैं?
नहीं। जनरेशन पूरी तरह आपके ब्राउज़र में क्रिप्टोग्राफिकली सुरक्षित रैंडम सोर्स का उपयोग करके होता है — कुछ भी सर्वर पर नहीं भेजा जाता।
UUID v7 क्या है और डेटाबेस के लिए यह v4 से बेहतर क्यों है?
UUID v7 शुरुआती बिट्स में टाइमस्टैम्प एम्बेड करता है, इसलिए वैल्यूज़ स्वाभाविक रूप से क्रिएशन टाइम के अनुसार सॉर्ट होती हैं — पूरी तरह रैंडम v4 के उलट, जो नए रिकॉर्ड के अस्त-व्यस्त इंसर्शन ऑर्डर के कारण डेटाबेस इंडेक्स की परफ़ॉर्मेंस पर बुरा असर डालता है।
क्या UUID को सीक्रेट टोकन के रूप में इस्तेमाल किया जा सकता है?
UUID v4 के लिए — हाँ, क्योंकि यह क्रिप्टोग्राफिकली सुरक्षित रैंडमनेस जनरेटर से बनता है। लेकिन UUID v1 क्रिएशन टाइम और डिवाइस का MAC एड्रेस आंशिक रूप से उजागर करता है, इसलिए यह वहां उपयुक्त नहीं जहां अप्रत्याशितता ज़रूरी है।