From: Brian Candler Date: 2008-10-24T16:58:19+09:00 Subject: Re: Big endian convention in Ruby Brian Candler wrote: > I > suggest you debug it by putting lots of debugging statements in, e.g. > > puts "h0 = #{h0.inspect}" ... and I also suggest you start with the message padding. For example, the message "abcde" should pad to "abcde\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000(" That is, "abcde" followed by 0x80 followed by 50 zeros (making 56 bytes so far), followed by 00 00 00 00 00 00 00 28 which is the length of the message in bits as a 64-bit big-endian value, to give a 64-byte block. If the message doesn't look like this before you enter your block processing loop, then there's no hope of getting the right answer (GIGO principle) -- Posted via http://www.ruby-forum.com/.