Mega Code Archive

 
Categories / Ruby / String
 

Checksums

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