UUID v3 Generator

MD5 का उपयोग करके नाम-आधारित निर्धारक UUID v3 जनरेट करें

नेमस्पेस

6ba7b810-9dad-11d1-80b4-00c04fd430c8

नाम

जनरेट किया गया UUID v3

नाम दर्ज करें और जनरेट पर क्लिक करें
एक ही नेमस्पेस + नाम हमेशा एक ही UUID देता है
Note:UUID v3 एक legacy format है जो MD5 hashing use करता है। Deterministic UUIDs require करने वाले नए development के लिए, UUID v5 (SHA-1) prefer करें। General-purpose unique IDs के लिए, UUID v4 use करें।

UUID v3 क्या है?

UUID v3 एक name-based UUID version है जो RFC 4122 में define किया गया है। Random data या timestamp के बजाय, यह deterministically दो inputs से UUID derive करता है: एक namespace UUID और एक name string। Namespace + name pair को MD5 use करके hash किया जाता है।

UUID v3 की key property determinism है: same namespace और name हमेशा identical UUID produce करेंगे, किसी भी machine पर, किसी भी समय। यह content-addressing के लिए suitable बनाता है।

UUID v3 MD5 hash function use करता है। MD5 security purposes के लिए cryptographically broken माना जाता है, इसलिए UUID v5 (जो SHA-1 use करता है) नए development के लिए generally preferred है।

Standard Namespaces

RFC 4122 चार pre-assigned namespace UUIDs define करता है। Standard namespace use करने से interoperability ensure होती है — दो independent implementations same namespace के भीतर same name के लिए same UUID v3 produce करेंगी:

NamespaceUUIDके लिए Use करें
DNS6ba7b810-9dad-11d1-80b4-00c04fd430c8Fully qualified domain names (जैसे 'example.com')
URL6ba7b811-9dad-11d1-80b4-00c04fd430c8URLs और URIs (जैसे 'https://example.com/resource')
OID6ba7b812-9dad-11d1-80b4-00c04fd430c8ISO Object Identifiers (जैसे '1.2.840.113556')
X.5006ba7b814-9dad-11d1-80b4-00c04fd430c8X.500 Distinguished Names (जैसे 'cn=John,dc=example,dc=com')

आप किसी भी arbitrary UUID को custom namespace के रूप में भी use कर सकते हैं — उदाहरण के लिए, एक UUID v4 जो आप once generate करते हैं और अपने application में constant के रूप में embed करते हैं।

UUID v3 vs UUID v5

UUID v3 और UUID v5 structurally identical हैं — दोनों deterministic, name-based UUIDs हैं। केवल hash function differ करता है:

UUID v3
  • MD5 hashing use करता है
  • 128-bit output (UUID-sized)
  • RFC 4122 में Defined
  • MD5 cryptographically broken है
  • सभी UUID libraries द्वारा Supported
UUID v5
  • SHA-1 hashing use करता है
  • 160-bit hash truncated to 128 bits
  • RFC 4122 में Defined
  • SHA-1 security use के लिए deprecated लेकिन MD5 से stronger
  • सभी UUID libraries द्वारा Supported

सभी नए development के लिए UUID v3 पर UUID v5 prefer करें। SHA-1 hash MD5 से stronger है, और performance difference negligible है।

UUID v3 कब Use करें

UUID v3 (और v5) appropriate हैं जब आपको meaningful name से derived stable, reproducible identifier चाहिए — random ID के बजाय जो store और look up करनी हो:

URL canonicalization
किसी भी URL के लिए deterministic UUID generate करें database या cache में compact, fixed-length key के रूप में use करने के लिए।
DNS-based identifiers
Hostnames या domain names को stable UUIDs assign करें जो deployments और databases में consistent रहें।
Content addressing
Content items के लिए reproducible IDs create करें जो उनके canonical name से identified हों।
Idempotent resource creation
Same resource name के लिए same UUID generate करें ताकि repeated creation attempts naturally idempotent हों बिना lookup के।
Test fixtures
Test data में stable, predictable UUIDs produce करें ताकि test assertions update न करने पड़ें।
Cross-system deduplication
दो independent systems बिना communication के same name के लिए same UUID derive कर सकते हैं, shared ID registry के बिना deduplication enable करते हैं।

Determinism को समझना

UUID v3 का determinism इसकी greatest strength और most important constraint दोनों है। किसी भी namespace UUID और किसी भी name string के साथ, output UUID completely fixed है।

Example (DNS namespace, name = 'example.com'):9073926b-929f-31c2-abc9-fad77ae3e8eb

हमेशा produces: 9073926b-929f-31c2-abc9-fad77ae3e8eb

यदि attacker namespace जानता है और name guess कर सकता है, तो वो UUID advance में compute कर सकता है। UUID v3 values कभी भी unpredictable tokens, session IDs, या secrets के रूप में use नहीं करनी चाहिए। Security-sensitive identifier के लिए UUID v4 use करें।

Code Examples

UUID v3 के लिए namespace UUID और name string required हैं। Standard uuid package use करें:

JavaScript / Node.js
// Browser / Node.js — UUID v3 without dependencies
function uuidV3(namespace, name) {
  // namespace must be a UUID string like '6ba7b810-9dad-11d1-80b4-00c04fd430c8'
  const nsBytes = namespace.replace(/-/g, '').match(/../g).map(h => parseInt(h, 16))
  const nameBytes = [...new TextEncoder().encode(name)]
  const combined = new Uint8Array([...nsBytes, ...nameBytes])

  // md5(combined) — use your preferred MD5 library or the inline implementation
  const hash = md5(combined) // returns Uint8Array(16)
  hash[6] = (hash[6] & 0x0f) | 0x30 // version 3
  hash[8] = (hash[8] & 0x3f) | 0x80 // variant

  const h = [...hash].map(b => b.toString(16).padStart(2, '0')).join('')
  return `${h.slice(0,8)}-${h.slice(8,12)}-${h.slice(12,16)}-${h.slice(16,20)}-${h.slice(20)}`
}

// Using the 'uuid' npm package
import { v3 as uuidv3 } from 'uuid'
const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'
console.log(uuidv3('example.com', uuidv3.DNS))
// → '9073926b-929f-31c2-abc9-fad77ae3e8eb' (always the same)
Python
import uuid

# Using the standard library
dns_uuid = uuid.uuid3(uuid.NAMESPACE_DNS, 'example.com')
print(dns_uuid)
# → 9073926b-929f-31c2-abc9-fad77ae3e8eb

url_uuid = uuid.uuid3(uuid.NAMESPACE_URL, 'https://example.com/page')
print(url_uuid)

# Custom namespace
MY_NS = uuid.UUID('a1b2c3d4-e5f6-7890-abcd-ef1234567890')
custom = uuid.uuid3(MY_NS, 'my-entity-name')
print(custom)
Go
package main

import (
    "fmt"
    "github.com/google/uuid"
)

func main() {
    // Standard DNS namespace
    ns := uuid.MustParse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
    id := uuid.NewMD5(ns, []byte("example.com"))
    fmt.Println(id)
    // → 9073926b-929f-31c2-abc9-fad77ae3e8eb

    // URL namespace
    urlNS := uuid.MustParse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")
    idURL := uuid.NewMD5(urlNS, []byte("https://example.com/page"))
    fmt.Println(idURL)
}

अक्सर पूछे जाने वाले प्रश्न

क्या UUID v3 और UUID v5 interchangeable हैं?
नहीं — वे same inputs के लिए different outputs produce करते हैं क्योंकि वे different hash functions use करते हैं (MD5 vs SHA-1)। एक UUID v3 और UUID v5 same namespace + name से different UUIDs होंगे।
क्या UUID v3 collision-resistant है?
Given namespace में, दो different names different UUID v3 values produce करेंगे जब तक MD5 उन specific inputs के लिए collision produce न करे। MD5 collision attacks exist करते हैं लेकिन carefully crafted inputs require करते हैं।
क्या मैं UUID v3 को database में primary key के रूप में use कर सकता हूँ?
हाँ, यदि आप trade-offs समझते हैं। UUID v3 deterministic है — same name के लिए same key generate होगी। हालाँकि, UUID v3 generation order के अनुसार sortable नहीं है।
Name input के लिए मुझे कौन सी encoding use करनी चाहिए?
RFC 4122 specify करता है कि name namespace के canonical form का use करके bytes में convert होना चाहिए। DNS namespace के लिए, domain name को trailing dot के बिना UTF-8 string के रूप में use करें।
क्या UUID v3 original name hide करता है?
MD5 one-way function है — आप UUID v3 से original name recover नहीं कर सकते। हालाँकि, यदि attacker namespace जानता है और possible names का small set suspect करता है, वो precompute और compare कर सकता है।