Results 1 to 8 of 8

Thread: What the !@#!@ is a checksum??

  1. #1

    Thread Starter
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375

    Question What the !@#!@ is a checksum??

    Ive been hearing the term lately...whats a checksum? Is it something used to detect whether your program is being cracked or something??
    You just proved that sig advertisements work.

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    no, it goes on the end of something that verifies the data befoere it. If you look at ISBN numbers, you'll see the last number is 0-9 or X, that is the check digit which verifies the rest of it.

    It's mainly used for inputting, when it will detect if you have entered any characters wrongly.

  3. #3
    I believe it is used in a CRC.

  4. #4

    Thread Starter
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375
    Hmm i feel even stupidier than before...whats a CRC by the way?
    You just proved that sig advertisements work.

  5. #5
    ZIP files have it for that exact reason.

  6. #6

    Thread Starter
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375
    I dont mean to be a pain...but how do they work? If they're just a few chars at the end of some data then how can they verify the integrity of the entire thing?
    You just proved that sig advertisements work.

  7. #7
    Addicted Member Geoff Gunson's Avatar
    Join Date
    Jun 1999
    Posts
    241
    The check sum is calulated by the value of each byte and their position therefore some simple packet like:

    1234

    will not have the same checksum as

    4321

    So what you do is to calcluate a check sum with the incoming data and see if that answer matchs the one sent in the packet.


    For instance a real crappy check sum maker would be

    For i = 0 to len
    sum = sum + data(i) + (1024^i)
    next i

    Where data is an array of byte values.

    HTH

    G

  8. #8
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    Another crappy checksum, but you will get the idea:


    VB Code:
    1. Function Checksum(path As String) As Byte
    2.  If len(Dir$(path)) Then
    3.  
    4.    Dim fnum As Long
    5.    Dim ByteVar As Byte
    6.    
    7.    fnum = FreeFile
    8.    
    9.    Open path For Binary As #fnum
    10.    While Not EOF(fnum)
    11.       Get #fnum, , ByteVar 'Get a byte at a time as buffer was defined as a single byte
    12.       Checksum = Checksum Xor ByteVar
    13.    Wend
    14.    Close #fnum
    15.  
    16.  End If
    17. End Function

    I think it is faster to do this using asm and then implementing in VB.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width