Skip to content

Instantly share code, notes, and snippets.

@hackervera
Created December 17, 2011 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hackervera/1491238 to your computer and use it in GitHub Desktop.
Save hackervera/1491238 to your computer and use it in GitHub Desktop.
str = "Hello my name is tyler"
p str
p str.bytes.count
byte_string = str.unpack('m*').first
p byte_string
p byte_string.bytes.count
p [byte_string].pack('m*')
/Users/tyler> ruby junpack.rb
"Hello my name is tyler"
22
"\x1D\xE9e\xA2l\xA7jg\xA2\xB2\xDC\xA5"
12
"Hellomynameistyl\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment