CRC / checksum

This is a discussion on CRC / checksum within the C++ Programming forums, part of the General Programming Boards category; I'm a newbie to C++ so bare with me please. Iíve read FAQs and documents on CRC but nothing covers ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    3

    Getting CRC / checksum and verifying

    I'm a newbie to C++ so bare with me please. Iíve read FAQs and documents on CRC but nothing covers what I want to do. Nothing that I've found anyway

    I would like to read several binary files into my client hook for TFC and get their CRC values. Then I would like to check the values each file generated against a table of accepted values for that file.

    Itís a simple form of cheat protection. If the client is found to have a file that does not match one of the accepted values the hook can take required action.

    Is this a silly idea? Are there any better methods?


    This is the crc.h that comes with the HL SDK

    Code:
    #ifndef CRC_H
    #define CRC_H
    #ifdef _WIN32
    #pragma once
    #endif
    
    // MD5 Hash
    typedef struct
    {
    	unsigned int buf[4];
        unsigned int bits[2];
        unsigned char in[64];
    } MD5Context_t;
    
    
    typedef unsigned long CRC32_t;
    void CRC32_Init(CRC32_t *pulCRC);
    CRC32_t CRC32_Final(CRC32_t pulCRC);
    void CRC32_ProcessBuffer(CRC32_t *pulCRC, void *p, int len);
    void CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch);
    int CRC_File(CRC32_t *crcvalue, char *pszFileName);
    
    unsigned char COM_BlockSequenceCRCByte (unsigned char *base,
            int length, int sequence);
    
    void MD5Init(MD5Context_t *context);
    void MD5Update(MD5Context_t *context, unsigned char const *buf,
                   unsigned int len);
    void MD5Final(unsigned char digest[16], MD5Context_t *context);
    void Transform(unsigned int buf[4], unsigned int const in[16]);
    
    int MD5_Hash_File(unsigned char digest[16], char *pszFileName, int bUsefopen,
            int bSeed, unsigned int seed[4]);
    char *MD5_Print(unsigned char hash[16]);
    int MD5_Hash_CachedFile(unsigned char digest[16], unsigned char *pCache,
            int nFileSize, int bSeed, unsigned int seed[4]);
    
    int CRC_MapFile(CRC32_t *crcvalue, char *pszFileName);
    
    #endif
    Last edited by Zoltarc; 11-30-2002 at 11:15 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. checksum sender vs reciever?
    By silhoutte75 in forum C Programming
    Replies: 1
    Last Post: 04-13-2008, 02:27 PM
  2. weird checksum function
    By sagitt13 in forum C Programming
    Replies: 7
    Last Post: 10-31-2006, 01:25 AM
  3. A breakthrough
    By loopy in forum Linux Programming
    Replies: 4
    Last Post: 11-26-2003, 06:46 PM
  4. Reading Binary file to find Checksum
    By Abbila in forum C++ Programming
    Replies: 0
    Last Post: 09-25-2002, 10:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21