uuidtools.rb
上传用户:netsea168
上传日期:2022-07-22
资源大小:4652k
文件大小:20k
源码类别:

Ajax

开发平台:

Others

  1. #--
  2. # Copyright (c) 2005 Robert Aman
  3. #
  4. # Permission is hereby granted, free of charge, to any person obtaining
  5. # a copy of this software and associated documentation files (the
  6. # "Software"), to deal in the Software without restriction, including
  7. # without limitation the rights to use, copy, modify, merge, publish,
  8. # distribute, sublicense, and/or sell copies of the Software, and to
  9. # permit persons to whom the Software is furnished to do so, subject to
  10. # the following conditions:
  11. #
  12. # The above copyright notice and this permission notice shall be
  13. # included in all copies or substantial portions of the Software.
  14. #
  15. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  19. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  20. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  21. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. #++
  23. UUID_TOOLS_VERSION = "0.1.1"
  24. $:.unshift(File.dirname(__FILE__))
  25. require 'uri'
  26. require 'time'
  27. require 'thread'
  28. require 'digest/sha1'
  29. require 'digest/md5'
  30. #  Because it's impossible to hype a UUID generator on its genuine merits,
  31. #  I give you... Really bad ASCII art in the comments:
  32. #
  33. #                                                                  
  34. #                                                                 
  35. #                /                                                   
  36. #               +                                                  
  37. #              ]                                                   
  38. #              ]                                                   
  39. #              |                                                    
  40. #             /                                                     
  41. #           Mp___                                                  
  42. #              `~0NNp,                                             
  43. #               __ggM'                                             
  44. #             g0M~"`                                               
  45. #            ]0M*-                                                 
  46. #                                                                  
  47. #                    ___                                           
  48. #                _g000M00g,                                        
  49. #              j0M~      ~M&                                       
  50. #            j0M"          ~N,                                     
  51. #           j0P              M&                                    
  52. #          jM                  1                                   
  53. #         j0                   ]1                                  
  54. #        .0P                    0,                                 
  55. #        00'                    M&                                 
  56. #        0M                     ]0L                                
  57. #       ]0f         ___          M0                                
  58. #        M0NN0M00MMM~"'M          0&                               
  59. #          `~          ~0         ]0,                              
  60. #                       ]M        ]0&                              
  61. #                        M&        M0,                             
  62. #               ____gp_   M&        M0_                            
  63. #            __p0MPM8MM&_  M/        ^0&_                          
  64. #           gN"`       M0N_j0,         MM&__                       
  65. #         _gF           `~M0P`   __      M00g                      
  66. #        g0'                    gM0&,     ~M0&                     
  67. #      _pM`                     0, ]M1     "00&                    
  68. #     _00                    /g1MMgj01      ]0MI                   
  69. #    _0F                     t"M,7MMM        00I                   
  70. #   g0'                  _   N&j&            40'                   
  71. #  g0'                _p0Mq_   '             N0QQNM#g,             
  72. #  0'              _g0000000g__              ~M@MMM000g            
  73. #  f             _jM00@`  ~M0000Mgppg,             "P00&           
  74. # |             g000~       `~M000000&_               ~0&          
  75. # ]M          _M00F              "00MM`                ~#&         
  76. # `0L        m000F                #E                    "0f        
  77. #   9r     j000M`                 40,                    00        
  78. #    ]0g_ j00M`                   ^M0MNggp#gqpg          M0&       
  79. #     ~MPM0f                         ~M000000000g_ ,_ygg&M00f      
  80. #                                        `~~~M00000000000000       
  81. #                                              `M0000000000f       
  82. #                                                  ~@@@MF~`        
  83. #                                                                  
  84. #                                                                  
  85. #= uuidtools.rb
  86. #
  87. # UUIDTools was designed to be a simple library for generating any
  88. # of the various types of UUIDs.  It conforms to RFC 4122 whenever
  89. # possible.
  90. #
  91. #== Example
  92. #  UUID.md5_create(UUID_DNS_NAMESPACE, "www.widgets.com")
  93. #  => #<UUID:0x287576 UUID:3d813cbb-47fb-32ba-91df-831e1593ac29>
  94. #  UUID.sha1_create(UUID_DNS_NAMESPACE, "www.widgets.com")
  95. #  => #<UUID:0x2a0116 UUID:21f7f8de-8051-5b89-8680-0195ef798b6a>
  96. #  UUID.timestamp_create
  97. #  => #<UUID:0x2adfdc UUID:64a5189c-25b3-11da-a97b-00c04fd430c8>
  98. #  UUID.random_create
  99. #  => #<UUID:0x19013a UUID:984265dc-4200-4f02-ae70-fe4f48964159>
  100. class UUID
  101.   @@last_timestamp = nil
  102.   @@last_node_id = nil
  103.   @@last_clock_sequence = nil
  104.   @@state_file = nil
  105.   @@mutex = Mutex.new
  106.   
  107.   def initialize(time_low, time_mid, time_hi_and_version,
  108.       clock_seq_hi_and_reserved, clock_seq_low, nodes)
  109.     unless time_low >= 0 && time_low < 4294967296
  110.       raise ArgumentError,
  111.         "Expected unsigned 32-bit number for time_low, got #{time_low}."
  112.     end
  113.     unless time_mid >= 0 && time_mid < 65536
  114.       raise ArgumentError,
  115.         "Expected unsigned 16-bit number for time_mid, got #{time_mid}."
  116.     end
  117.     unless time_hi_and_version >= 0 && time_hi_and_version < 65536
  118.       raise ArgumentError,
  119.         "Expected unsigned 16-bit number for time_hi_and_version, " +
  120.         "got #{time_hi_and_version}."
  121.     end
  122.     unless clock_seq_hi_and_reserved >= 0 && clock_seq_hi_and_reserved < 256
  123.       raise ArgumentError,
  124.         "Expected unsigned 8-bit number for clock_seq_hi_and_reserved, " +
  125.         "got #{clock_seq_hi_and_reserved}."
  126.     end
  127.     unless clock_seq_low >= 0 && clock_seq_low < 256
  128.       raise ArgumentError,
  129.         "Expected unsigned 8-bit number for clock_seq_low, " +
  130.         "got #{clock_seq_low}."
  131.     end
  132.     unless nodes.respond_to? :size
  133.       raise ArgumentError,
  134.         "Expected nodes to respond to :size."
  135.     end  
  136.     unless nodes.size == 6
  137.       raise ArgumentError,
  138.         "Expected nodes to have size of 6."
  139.     end
  140.     for node in nodes
  141.       unless node >= 0 && node < 256
  142.         raise ArgumentError,
  143.           "Expected unsigned 8-bit number for each node, " +
  144.           "got #{node}."
  145.       end
  146.     end
  147.     @time_low = time_low
  148.     @time_mid = time_mid
  149.     @time_hi_and_version = time_hi_and_version
  150.     @clock_seq_hi_and_reserved = clock_seq_hi_and_reserved
  151.     @clock_seq_low = clock_seq_low
  152.     @nodes = nodes
  153.   end
  154.   
  155.   attr_accessor :time_low
  156.   attr_accessor :time_mid
  157.   attr_accessor :time_hi_and_version
  158.   attr_accessor :clock_seq_hi_and_reserved
  159.   attr_accessor :clock_seq_low
  160.   attr_accessor :nodes
  161.   
  162.   # Parses a UUID from a string.
  163.   def UUID.parse(uuid_string)
  164.     unless uuid_string.kind_of? String
  165.       raise ArgumentError,
  166.         "Expected String, got #{uuid_string.class.name} instead."
  167.     end
  168.     uuid_components = uuid_string.downcase.scan(
  169.       Regexp.new("^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-" +
  170.         "([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})$")).first
  171.     raise ArgumentError, "Invalid UUID format." if uuid_components.nil?
  172.     time_low = uuid_components[0].to_i(16)
  173.     time_mid = uuid_components[1].to_i(16)
  174.     time_hi_and_version = uuid_components[2].to_i(16)
  175.     clock_seq_hi_and_reserved = uuid_components[3].to_i(16)
  176.     clock_seq_low = uuid_components[4].to_i(16)
  177.     nodes = []
  178.     for i in 0..5
  179.       nodes << uuid_components[5][(i * 2)..(i * 2) + 1].to_i(16)
  180.     end
  181.     return UUID.new(time_low, time_mid, time_hi_and_version,
  182.       clock_seq_hi_and_reserved, clock_seq_low, nodes)
  183.   end
  184.   # Parses a UUID from a raw byte string.
  185.   def UUID.parse_raw(raw_string)
  186.     unless raw_string.kind_of? String
  187.       raise ArgumentError,
  188.         "Expected String, got #{raw_string.class.name} instead."
  189.     end
  190.     integer = UUID.convert_byte_string_to_int(raw_string)
  191.     time_low = (integer >> 96) & 0xFFFFFFFF
  192.     time_mid = (integer >> 80) & 0xFFFF
  193.     time_hi_and_version = (integer >> 64) & 0xFFFF
  194.     clock_seq_hi_and_reserved = (integer >> 56) & 0xFF
  195.     clock_seq_low = (integer >> 48) & 0xFF
  196.     nodes = []
  197.     for i in 0..5
  198.       nodes << ((integer >> (40 - (i * 8))) & 0xFF)
  199.     end
  200.     return UUID.new(time_low, time_mid, time_hi_and_version,
  201.       clock_seq_hi_and_reserved, clock_seq_low, nodes)
  202.   end
  203.   # Creates a UUID from a random value.
  204.   def UUID.random_create()
  205.     new_uuid = UUID.parse_raw(UUID.true_random)
  206.     new_uuid.time_hi_and_version &= 0x0FFF
  207.     new_uuid.time_hi_and_version |= (4 << 12)
  208.     new_uuid.clock_seq_hi_and_reserved &= 0x3F
  209.     new_uuid.clock_seq_hi_and_reserved |= 0x80
  210.     return new_uuid
  211.   end
  212.   # Creates a UUID from a timestamp.
  213.   def UUID.timestamp_create(timestamp=nil)
  214.     # We need a lock here to prevent two threads from ever
  215.     # getting the same timestamp.
  216.     @@mutex.synchronize do
  217.       # Always use GMT to generate UUIDs.
  218.       gmt_timestamp = Time.now.gmtime
  219.       # Convert to 100 nanosecond blocks
  220.       gmt_timestamp_100_nanoseconds = (gmt_timestamp.tv_sec * 10000000) +
  221.         (gmt_timestamp.tv_usec * 10) + 0x01B21DD213814000
  222.       nodes = UUID.get_mac_address.split(":").collect do |octet|
  223.         octet.to_i(16)
  224.       end
  225.       node_id = 0
  226.       for i in 0..5
  227.         node_id += (nodes[i] << (40 - (i * 8)))
  228.       end
  229.       clock_sequence = @@last_clock_sequence
  230.       if clock_sequence.nil?
  231.         clock_sequence = UUID.convert_byte_string_to_int(UUID.true_random)
  232.       end
  233.       if @@last_node_id != nil && @@last_node_id != node_id
  234.         # The node id has changed.  Change the clock id.
  235.         clock_sequence = UUID.convert_byte_string_to_int(UUID.true_random)
  236.       elsif @@last_timestamp != nil &&
  237.           gmt_timestamp_100_nanoseconds < @@last_timestamp
  238.         clock_sequence = clock_sequence + 1
  239.       end
  240.       @@last_timestamp = gmt_timestamp_100_nanoseconds
  241.       @@last_node_id = node_id
  242.       @@last_clock_sequence = clock_sequence
  243.       time_low = gmt_timestamp_100_nanoseconds & 0xFFFFFFFF
  244.       time_mid = ((gmt_timestamp_100_nanoseconds >> 32) & 0xFFFF)
  245.       time_hi_and_version = ((gmt_timestamp_100_nanoseconds >> 48) & 0x0FFF)
  246.       time_hi_and_version |= (1 << 12)
  247.       clock_seq_low = clock_sequence & 0xFF;
  248.       clock_seq_hi_and_reserved = (clock_sequence & 0x3F00) >> 8
  249.       clock_seq_hi_and_reserved |= 0x80
  250.       
  251.       return UUID.new(time_low, time_mid, time_hi_and_version,
  252.         clock_seq_hi_and_reserved, clock_seq_low, nodes)
  253.     end
  254.   end
  255.   # Creates a UUID using the MD5 hash.  (Version 3)
  256.   def UUID.md5_create(namespace, name)
  257.     return UUID.create_from_hash(Digest::MD5, namespace, name)
  258.   end
  259.   
  260.   # Creates a UUID using the SHA1 hash.  (Version 5)
  261.   def UUID.sha1_create(namespace, name)
  262.     return UUID.create_from_hash(Digest::SHA1, namespace, name)
  263.   end
  264.   
  265.   # This method applies only to version 1 UUIDs.
  266.   # Checks if the node ID was generated from a random number
  267.   # or from an IEEE 802 address (MAC address).
  268.   # Always returns false for UUIDs that aren't version 1.
  269.   # This should not be confused with version 4 UUIDs where
  270.   # more than just the node id is random.
  271.   def random_node_id?
  272.     return false if self.version != 1
  273.     return ((self.nodes.first & 0x01) == 1)
  274.   end
  275.   
  276.   # Returns true if this UUID is the
  277.   # nil UUID (00000000-0000-0000-0000-000000000000).
  278.   def nil_uuid?
  279.     return false if self.time_low != 0
  280.     return false if self.time_mid != 0
  281.     return false if self.time_hi_and_version != 0
  282.     return false if self.clock_seq_hi_and_reserved != 0
  283.     return false if self.clock_seq_low != 0
  284.     self.nodes.each do |node|
  285.       return false if node != 0
  286.     end
  287.     return true
  288.   end
  289.   
  290.   # Returns the UUID version type.
  291.   # Possible values:
  292.   # 1 - Time-based with unique or random host identifier
  293.   # 2 - DCE Security version (with POSIX UIDs)
  294.   # 3 - Name-based (MD5 hash)
  295.   # 4 - Random
  296.   # 5 - Name-based (SHA-1 hash)
  297.   def version
  298.     return (time_hi_and_version >> 12)
  299.   end
  300.   # Returns the UUID variant.
  301.   # Possible values:
  302.   # 0b000 - Reserved, NCS backward compatibility.
  303.   # 0b100 - The variant specified in this document.
  304.   # 0b110 - Reserved, Microsoft Corporation backward compatibility.
  305.   # 0b111 - Reserved for future definition.
  306.   def variant
  307.     variant_raw = (clock_seq_hi_and_reserved >> 5)
  308.     result = nil
  309.     if (variant_raw >> 2) == 0
  310.       result = 0x000
  311.     elsif (variant_raw >> 1) == 2
  312.       result = 0x100
  313.     else
  314.       result = variant_raw
  315.     end
  316.     return result
  317.   end
  318.   
  319.   # Returns the IEEE 802 address used to generate this UUID or
  320.   # nil if a MAC address was not used.
  321.   def mac_address
  322.     return nil if self.version != 1
  323.     return nil if self.random_node_id?
  324.     return (self.nodes.collect do |node|
  325.       sprintf("%2.2x", node)
  326.     end).join(":")
  327.   end
  328.   
  329.   # Returns the timestamp used to generate this UUID
  330.   def timestamp
  331.     return nil if self.version != 1
  332.     gmt_timestamp_100_nanoseconds = 0
  333.     gmt_timestamp_100_nanoseconds +=
  334.       ((self.time_hi_and_version  & 0x0FFF) << 48)
  335.     gmt_timestamp_100_nanoseconds += (self.time_mid << 32)
  336.     gmt_timestamp_100_nanoseconds += self.time_low
  337.     return Time.at(
  338.       (gmt_timestamp_100_nanoseconds - 0x01B21DD213814000) / 10000000.0)
  339.   end
  340.   
  341.   # Compares two UUIDs lexically
  342.   def <=>(other_uuid)
  343.     check = self.time_low <=> other_uuid.time_low
  344.     return check if check != 0
  345.     check = self.time_mid <=> other_uuid.time_mid
  346.     return check if check != 0
  347.     check = self.time_hi_and_version <=> other_uuid.time_hi_and_version
  348.     return check if check != 0
  349.     check = self.clock_seq_hi_and_reserved <=>
  350.       other_uuid.clock_seq_hi_and_reserved
  351.     return check if check != 0
  352.     check = self.clock_seq_low <=> other_uuid.clock_seq_low
  353.     return check if check != 0
  354.     for i in 0..5
  355.       if (self.nodes[i] < other_uuid.nodes[i])
  356.         return -1
  357.       end
  358.       if (self.nodes[i] > other_uuid.nodes[i])
  359.         return 1
  360.       end
  361.     end
  362.     return 0
  363.   end
  364.   
  365.   # Returns a representation of the object's state
  366.   def inspect
  367.     return "#<UUID:0x#{self.object_id.to_s(16)} UUID:#{self.to_s}>"
  368.   end
  369.   
  370.   # Returns the hex digest of the UUID object.
  371.   def hexdigest
  372.     return self.to_i.to_s(16)
  373.   end
  374.   
  375.   # Returns the raw bytes that represent this UUID.
  376.   def raw
  377.     return UUID.convert_int_to_byte_string(self.to_i, 16)
  378.   end
  379.   
  380.   # Returns a string representation for this UUID.
  381.   def to_s
  382.     result = sprintf("%8.8x-%4.4x-%4.4x-%2.2x%2.2x-", @time_low, @time_mid,
  383.       @time_hi_and_version, @clock_seq_hi_and_reserved, @clock_seq_low);
  384.     for i in 0..5
  385.       result << sprintf("%2.2x", @nodes[i])
  386.     end
  387.     return result
  388.   end
  389.   
  390.   # Returns an integer representation for this UUID.
  391.   def to_i
  392.     bytes = (time_low << 96) + (time_mid << 80) +
  393.       (time_hi_and_version << 64) + (clock_seq_hi_and_reserved << 56) +
  394.       (clock_seq_low << 48)
  395.     for i in 0..5
  396.       bytes += (nodes[i] << (40 - (i * 8)))
  397.     end
  398.     return bytes
  399.   end
  400.     
  401.   # Returns a URI for this UUID.
  402.   def to_uri
  403.     return URI.parse(self.to_uri_string)
  404.   end
  405.   # Returns a URI string for this UUID.
  406.   def to_uri_string
  407.     return "urn:uuid:#{self.to_s}"
  408.   end
  409.   
  410.   def UUID.create_from_hash(hash_class, namespace, name)
  411.     if hash_class == Digest::MD5
  412.       version = 3
  413.     elsif hash_class == Digest::SHA1
  414.       version = 5
  415.     else
  416.       raise ArgumentError,
  417.         "Expected Digest::SHA1 or Digest::MD5, got #{hash_class.name}."
  418.     end
  419.     hash = hash_class.new
  420.     hash.update(namespace.raw)
  421.     hash.update(name)
  422.     hash_string = hash.to_s[0..31]
  423.     new_uuid = UUID.parse("#{hash_string[0..7]}-#{hash_string[8..11]}-" +
  424.       "#{hash_string[12..15]}-#{hash_string[16..19]}-#{hash_string[20..31]}")
  425.     
  426.     new_uuid.time_hi_and_version &= 0x0FFF
  427.     new_uuid.time_hi_and_version |= (version << 12)
  428.     new_uuid.clock_seq_hi_and_reserved &= 0x3F
  429.     new_uuid.clock_seq_hi_and_reserved |= 0x80
  430.     return new_uuid
  431.   end
  432.   # Returns the MAC address of the current computer's network card.
  433.   # Returns nil if a MAC address could not be found.
  434.   def UUID.get_mac_address
  435.     if RUBY_PLATFORM =~ /win/ && !(RUBY_PLATFORM =~ /darwin/)
  436.       begin
  437.         ifconfig_output = `ipconfig /all`
  438.         mac_addresses = ifconfig_output.scan(
  439.           Regexp.new("(#{(["[0-9A-F]{2}"] * 6).join("-")})"))
  440.         if mac_addresses.size > 0
  441.           return mac_addresses.first.first.downcase.gsub(/-/, ":")
  442.         end
  443.       rescue
  444.       end
  445.     else
  446.       begin
  447.         ifconfig_output = `ifconfig`
  448.         mac_addresses = ifconfig_output.scan(
  449.           Regexp.new("ether (#{(["[0-9a-f]{2}"] * 6).join(":")})"))
  450.         if mac_addresses.size == 0
  451.           ifconfig_output = `ifconfig | grep HWaddr | cut -c39-`
  452.           mac_addresses = ifconfig_output.scan(
  453.             Regexp.new("(#{(["[0-9a-f]{2}"] * 6).join(":")})"))
  454.         end
  455.         if mac_addresses.size == 0
  456.           ifconfig_output = `/sbin/ifconfig`
  457.           mac_addresses = ifconfig_output.scan(
  458.             Regexp.new("ether (#{(["[0-9a-f]{2}"] * 6).join(":")})"))
  459.         end
  460.         if mac_addresses.size == 0
  461.           ifconfig_output = `/sbin/ifconfig | grep HWaddr | cut -c39-`
  462.           mac_addresses = ifconfig_output.scan(
  463.             Regexp.new("(#{(["[0-9a-f]{2}"] * 6).join(":")})"))
  464.         end
  465.         if mac_addresses.size > 0
  466.           return mac_addresses.first.first
  467.         end
  468.       rescue
  469.       end
  470.     end
  471.   end
  472.   
  473.   # Returns 128 bits of highly unpredictable data.
  474.   # The random number generator isn't perfect, but it's
  475.   # much, much better than the built-in pseudorandom number generators.
  476.   def UUID.true_random
  477.     require 'benchmark'
  478.     hash = Digest::SHA1.new
  479.     performance = Benchmark.measure do
  480.       hash.update(rand.to_s)
  481.       hash.update(srand.to_s)
  482.       hash.update(rand.to_s)
  483.       hash.update(srand.to_s)
  484.       hash.update(Time.now.to_s)
  485.       hash.update(rand.to_s)
  486.       hash.update(self.object_id.to_s)
  487.       hash.update(rand.to_s)
  488.       hash.update(hash.object_id.to_s)
  489.       hash.update(self.methods.inspect)
  490.       begin
  491.         random_device = nil
  492.         if File.exists? "/dev/urandom"
  493.           random_device = File.open "/dev/urandom", "r"
  494.         elsif File.exists? "/dev/random"
  495.           random_device = File.open "/dev/random", "r"
  496.         end
  497.         hash.update(random_device.read(20)) if random_device != nil
  498.       rescue
  499.       end
  500.       begin
  501.         srand(hash.to_s.to_i(16) >> 128)
  502.       rescue
  503.       end
  504.       hash.update(rand.to_s)
  505.       hash.update(UUID.true_random) if (rand(2) == 0)
  506.     end
  507.     hash.update(performance.real.to_s)
  508.     hash.update(performance.inspect)
  509.     return UUID.convert_int_to_byte_string(hash.to_s[4..35].to_i(16), 16)
  510.   end
  511.   
  512.   def UUID.convert_int_to_byte_string(integer, size)
  513.     byte_string = ""
  514.     for i in 0..(size - 1)
  515.       byte_string << ((integer >> (((size - 1) - i) * 8)) & 0xFF)
  516.     end
  517.     return byte_string
  518.   end
  519.   def UUID.convert_byte_string_to_int(byte_string)
  520.     integer = 0
  521.     size = byte_string.size
  522.     for i in 0..(size - 1)
  523.       integer += (byte_string[i] << (((size - 1) - i) * 8))
  524.     end
  525.     return integer
  526.   end
  527.   
  528.   class << self
  529.     protected :create_from_hash
  530.     protected :get_mac_address
  531.     protected :true_random
  532.     protected :convert_int_to_byte_string
  533.     protected :convert_byte_string_to_int
  534.   end
  535. end
  536. UUID_DNS_NAMESPACE = UUID.parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
  537. UUID_URL_NAMESPACE = UUID.parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")
  538. UUID_OID_NAMESPACE = UUID.parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")
  539. UUID_X500_NAMESPACE = UUID.parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")