Improved performance and code generation of cksum() function