On 01/23/2012 07:38 PM, Jan Kiszka wrote:
nums=`od -A n -t u1 -v -N $size "$1"` -for i in ${nums}; do - # add each byte's value to sum - sum=`expr \( $sum + $i \) % 256` -done - -sum=$(( (256 - $sum) % 256 ))
We have a bashism here, so why not do sum=$(( ($sum + $i) % 256 ))and do the same with a one-line patch (two line if you change the header to #!/bin/bash)? It should be just as fast as awk.
Paolo