UUID란

지니🧸·2023년 11월 8일
0

Java

목록 보기
13/13

For entities that have potential security risks for sequentially generated ID values, UUID is a commonly used class type in Spring Boot context.

Universally Unique ID

  • immutable
  • universally unique
  • 128-bit value
  • provided as class in Java

New UUID()

UUID uuid = new UUID(mostSignificant64Bits, leastSignificant64Bits);

UUID Versions

UUID V.1

  • based on current timestamp & MAC address of device generating UUID
  • current timestamp: measured in units of 100 nanoseconds from October 15, 1582
  • MAC address of device can be replaced by random 48-bit number

UUID V.3 & V.5

  • based on hashed names drawn from a unique namespace
  • concept of names is not limited to textual form
    • (Ex) DNS, Object Identifiers (OID), URLs, etc.

UUID V.3 vs. V.5

UUID V.3 and V.5 differ in hashing algorithm each uses.

  • UUID V.3 uses MD5 (128 bits)
  • UUID V.5 uses SHA-1 (160 bits) truncated to 128 bits

UUID V.4

  • generated with randomUUID() method provided by UUID class

References

profile
우당탕탕

0개의 댓글