From: Brian Candler Date: 2007-03-14T05:47:40+09:00 Subject: Re: Ruby Newbie Problems with deflate, base64... On Tue, Mar 13, 2007 at 01:21:52PM +0900, Pat Patterson wrote: > While the Ruby > > deflated = Zlib::Deflate.deflate( "Hello world" ) > myhex = "" > 1.upto(deflated.length) { |i| myhex << "%02x" % deflated[i] } > puts myhex > > Shows > > 9cf348cdc9c95728cf2fca49010018ab043d00 > > (BTW - if anyone knows a more succinct way to hex encode a string in > Ruby, that would be useful) str = "\001\377" puts str.unpack("H*")