You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] v3 / v5 do not produce RFC 4122 name-based UUIDs (hex text of the digest is used as the bytes) #52
uuid.v5(name, namespace) and uuid.v3(name, namespace) are deterministic, but the returned values differ from every other RFC 4122 implementation. In src/v35.ts:
hashfunc is hex_sha1 / hex_md5, which returns the digest as a lowercase hex string, and stringToBytes then converts each hex character to its ASCII code instead of decoding the hex bytes (so the UUID bytes 36 65 31 63 ... are the ASCII text "6e1c..."). In addition, bytesToString turns the 16 namespace bytes into a Latin-1 string and hex_sha1 / hex_md5 UTF-8 encodes that string again, so any namespace byte >= 0x80 is hashed as two UTF-8 bytes instead of one raw byte.
Expected Behavior
For "www.example.com" in the DNS namespace (6ba7b810-9dad-11d1-80b4-00c04fd430c8), RFC 4122 Appendix B, the uuid npm package, and Python's uuid.uuid5 / uuid.uuid3 produce:
v5: 2ed6657d-e927-568b-95e1-2665a8aea6a2
v3: 5df41881-3aed-3515-88a7-2f4a814cf09e
Actual Behavior
v5: 36653163-3630-5538-b731-646230306266
v3: 30633233-3762-3465-b333-303237346338
Steps to Reproduce
Install react-native-uuid@2.0.4.
Run uuid.v5("www.example.com", uuid.DNS) and uuid.v3("www.example.com", uuid.DNS).
Compare the output with uuid or RFC 4122 test vectors.
#18 previously reported this symptom (v5("orderId", "f87ff660-ef24-47a6-b9a8-d64545dd6a4e") returning 31306430-6633-5136-b061-636236373634) and was closed without a fix; 2.0.4 still returns that value.
Activity
eugenehp commentedon Nov 15, 2026
Thanks, published in https://github.com/eugenehp/react-native-uuid/releases/tag/v3.0.0