Calcolo checksum 1 byte

io farei cosi allora

byte CheckSum(byte arr[], int dim_array){
   byte total = 0;
   
   for(int i=0; i<dim_array; i++)
            total = (total + arr[i]);

   if(total>256) //100h = 256;
      total = total % 256;

   return total
}