Brian Candler
3/13/2007 8:48:00 PM
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*")