From: instance_variable ok Date: 2012-04-28T02:38:09+09:00 Subject: Re: why does this return 255 bits instead of 256 (and general bit byte hex string array crypt mayhem Yes but unfortunately I need the bit string, I was only getting its length to make sure it was correct. Strange that you get 256 for the first example, it tells me 255 if I do it this way: puts test_hash_value.to_s.to_i(16).to_s(2).length but 256 if I do it this way: puts OpenSSL::BN.new(test_hash_value.to_s, 16).to_s(2).unpack("B*")[0].length I agree that it is painful but I can't find a better way :/ at least it works -- Posted via http://www.ruby-forum.com/.