// MakeCRC.h: CMakeCRC クラスのインターフェイス
//
//////////////////////////////////////////////////////////////////////

#pragma once

#include "MakeHashAlgorithm.h"

class CMakeCRC16 : public CMakeHashAlgorithm
{
public:
    CMakeCRC16();
    ~CMakeCRC16();

    virtual char* GetHashName(char *pBuffer=NULL) { return (pBuffer) ? strcpy(pBuffer,"CRC16") : "CRC16"; }
    virtual DWORD GetHashValueSize() { return 2; }
    virtual DWORD GetHashBlockSize() { return 64; }
    virtual void Initialize();

    virtual BOOL Test();

private:
    virtual DWORD ComputeHashHelper(const void *pBuffer, DWORD len)
            { return ComputeHashHelper(pBuffer, NULL, len); }
    virtual DWORD ComputeHashHelper(const void *pBuffer, void *msg_digest, DWORD len);
    virtual void ComputeHashFinalHelper(void *msg_digest);

private:
    DWORD m_dwCRC16;
};


class CMakeCRC32 : public CMakeHashAlgorithm
{
public:
    CMakeCRC32();
    ~CMakeCRC32();

    virtual char* GetHashName(char *pBuffer=NULL) { return (pBuffer) ? strcpy(pBuffer,"CRC32") : "CRC32"; }
    virtual DWORD GetHashValueSize() { return 4; }
    virtual DWORD GetHashBlockSize() { return 64; }
    virtual void Initialize();

    virtual BOOL Test();

private:
    virtual DWORD ComputeHashHelper(const void *pBuffer, DWORD len)
            { return ComputeHashHelper(pBuffer, &m_dwCRC32, len); }
    virtual DWORD ComputeHashHelper(const void *pBuffer, void *msg_digest, DWORD len);
    virtual void ComputeHashFinalHelper(void *msg_digest);

private:
    DWORD m_dwCRC32;
};
