You only need to do the modulo-256 once at the end.
test =
"\x75\x63\x32\x21\x01\xA9\x94\x94\x94\x94\x94\x94\x94\x94\x94\x0a\x85"
puts (test.bytes.inject(:+) % 256).to_s(16)
#=> 98
···
--
Posted via http://www.ruby-forum.com/.
You only need to do the modulo-256 once at the end.
test =
"\x75\x63\x32\x21\x01\xA9\x94\x94\x94\x94\x94\x94\x94\x94\x94\x0a\x85"
puts (test.bytes.inject(:+) % 256).to_s(16)
#=> 98
--
Posted via http://www.ruby-forum.com/.