Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Calculate a Checksum

Calculate a Checksum

Scheduled Pinned Locked Moved C / C++ / MFC
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    youssef
    wrote on last edited by
    #1

    Hi, I would like to create a function to calculate a checksum for a arraydata. But I don't understand what I want for this checksum : " lower 8 bits of the sum from data1 to data10 equals to zero". My english is not perfect but I understand the sum of the data1 to data10 but equals to zero, I don't understand. Best regards youssef

    PJ ArendsP J 2 Replies Last reply
    0
    • Y youssef

      Hi, I would like to create a function to calculate a checksum for a arraydata. But I don't understand what I want for this checksum : " lower 8 bits of the sum from data1 to data10 equals to zero". My english is not perfect but I understand the sum of the data1 to data10 but equals to zero, I don't understand. Best regards youssef

      PJ ArendsP Offline
      PJ ArendsP Offline
      PJ Arends
      wrote on last edited by
      #2

      http://www.codeproject.com/cpp/checksum.asp --- Multitasking: Screwing up several things at once.

      Within you lies the power for good; Use it!

      1 Reply Last reply
      0
      • Y youssef

        Hi, I would like to create a function to calculate a checksum for a arraydata. But I don't understand what I want for this checksum : " lower 8 bits of the sum from data1 to data10 equals to zero". My english is not perfect but I understand the sum of the data1 to data10 but equals to zero, I don't understand. Best regards youssef

        J Offline
        J Offline
        Joe Moldovan
        wrote on last edited by
        #3

        Perhaps, BYTE checksum = 0; for ( int i = 0; i < 10; i++ ) { checksum += (BYTE)( data[ i ] ); } if ( checksum == 0 ) { good checksum } else { bad checksum } This means that one of your array values is a checksum value which makes the whole array add up to zero. PS: No one's English is perfect!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups