Checksums : sum « String « Ruby






Checksums


puts "hello".sum          # => 532: weak 16-bit checksum
puts "hello".sum(8)       # => 20: 8 bit checksum instead of 16 bit

 

Related examples in the same category

1.Call sum function from string class