# File lib/mcollective/ssl.rb, line 213 def self.uuid(string=nil) string ||= OpenSSL::Random.random_bytes(16).unpack('H*').shift uuid_name_space_dns = "\x6b\xa7\xb8\x10\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8" sha1 = Digest::SHA1.new sha1.update(uuid_name_space_dns) sha1.update(string) # first 16 bytes.. bytes = sha1.digest[0, 16].bytes.to_a # version 5 adjustments bytes[6] &= 0x0f bytes[6] |= 0x50 # variant is DCE 1.1 bytes[8] &= 0x3f bytes[8] |= 0x80 bytes = [4, 2, 2, 2, 6].collect do |i| bytes.slice!(0, i).pack('C*').unpack('H*') end bytes.join('-') end