quick start:g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_system.a #include <Checksum.h> Checksum(); boolean compute(); boolean get();
description:Checksum cksum; SysString str(L"Joe"); cksum.compute(str); ulong result = cksum.get();
static const String CLASS_NAME = L"Checksum";
enum ALGORITHM { CRC_16_CCITT = 0, CRC_16, CRC_12, MD5, DEF_ALGORITHM = CRC_16_CCITT };
enum IMPLEMENTATION { FAST = 0, SLOW, DEF_IMPLEMENTATION = FAST };
static const ulong CRC_INITIAL_VALUE = 0;
static const ulong CRC_12_POLYNOMIAL = 05401;
static const ulong CRC_16_POLYNOMIAL = 0120001;
static const ulong CRC_16_CCITT_POLYNOMIAL = 0102010;
static const long CRC_TABLE_LENGTH = 256;
static const long ERR = 1600;
static const long ERR_POLY = 1601;
ALGORITHM algorithm_d;
IMPLEMENTATION implementation_d;
ulong cksum_d;
static Integral::DEBUG debug_level_d;
static MemoryManager mgr_d;
boolean is_valid_d;
ulong crc_table_d[CRC_TABLE_LENGTH];
static const SysString& name();
static boolean diagnose(Integral::DEBUG debug_level);
static boolean setDebug(Integral::DEBUG level);
boolean debug(const unichar* message) const;
~Checksum();
Checksum();
Checksum(const Checksum& arg);
boolean assign(const Checksum& arg);
Checksum& operator=(const Checksum& arg_a);
i/o methods are omitted because this class can't write itself to an Sof file
boolean eq(const Checksum& arg);
static void* operator new(size_t size);
static void* operator new[](size_t size);
static void operator delete(void* ptr);
static void operator delete[](void* ptr);
static boolean setGrowSize(long grow_size);
boolean clear(Integral::CMODE ctype_a = Integral::DEF_CMODE);
boolean setAlgorithm(ALGORITHM algorithm);
boolean setImplementation(IMPLEMENTATION implementation);
ALGORITHM getAlgorithm() const;
IMPLEMENTATION getImplementation() const;
ulong get() const;
operator ulong() const;
boolean init();
boolean compute(const SysString& input);
boolean compute(const byte* input, long nbytes);
boolean initCrc(ulong poly);
boolean computeCrcFast(const SysString& arg);
boolean computeCrcFast(const byte* input, long nbytes);
boolean reset();
Checksum cksum; String str(L"Joe"); cksum.compute(str); ulong result = cksum.get();
Checksum cksum; cksum.setAlgorithm(CRC_16); cksum.setImplementation(FAST); String str1(L"Joe"); String str2(L"xxyyzz"); cksum.compute(str1); cksum.compute(str2); ulong result = cksum.get();Note that the resulting checksum value is computing over the concatenation of both strings, making it easy for this class to be used to compute checksums across large chunks of data, including files.