Method: Rex::Text.to_guid
- Defined in:
- lib/rex/text.rb
.to_guid(bytes) ⇒ String
Convert 16-byte string to a GUID string
1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 |
# File 'lib/rex/text.rb', line 1298 def self.to_guid(bytes) return nil unless bytes s = bytes.unpack('H*')[0] parts = [ s[6, 2] + s[4, 2] + s[2, 2] + s[0, 2], s[10, 2] + s[8, 2], s[14, 2] + s[12, 2], s[16, 4], s[20, 12] ] "{#{parts.join('-')}}" end |