Fletcher's checksum in javascript