diff options
Diffstat (limited to 'src/checksum')
-rw-r--r-- | src/checksum/adler32/adler32.cpp | 4 | ||||
-rw-r--r-- | src/checksum/adler32/adler32.h | 2 | ||||
-rw-r--r-- | src/checksum/crc24/crc24.cpp | 12 | ||||
-rw-r--r-- | src/checksum/crc24/crc24.h | 2 | ||||
-rw-r--r-- | src/checksum/crc32/crc32.cpp | 6 | ||||
-rw-r--r-- | src/checksum/crc32/crc32.h | 2 |
6 files changed, 15 insertions, 13 deletions
diff --git a/src/checksum/adler32/adler32.cpp b/src/checksum/adler32/adler32.cpp index 09e42b8db..62589733f 100644 --- a/src/checksum/adler32/adler32.cpp +++ b/src/checksum/adler32/adler32.cpp @@ -55,9 +55,9 @@ void adler32_update(const byte input[], size_t length, /* * Update an Adler32 Checksum */ -void Adler32::add_data(const byte input[], u32bit length) +void Adler32::add_data(const byte input[], size_t length) { - const u32bit PROCESS_AMOUNT = 5552; + const size_t PROCESS_AMOUNT = 5552; while(length >= PROCESS_AMOUNT) { diff --git a/src/checksum/adler32/adler32.h b/src/checksum/adler32/adler32.h index 4993e601b..3a2441ad3 100644 --- a/src/checksum/adler32/adler32.h +++ b/src/checksum/adler32/adler32.h @@ -24,7 +24,7 @@ class BOTAN_DLL Adler32 : public HashFunction Adler32() : HashFunction(4) { clear(); } ~Adler32() { clear(); } private: - void add_data(const byte[], u32bit); + void add_data(const byte[], size_t); void final_result(byte[]); u16bit S1, S2; }; diff --git a/src/checksum/crc24/crc24.cpp b/src/checksum/crc24/crc24.cpp index 5441020f5..d641047a2 100644 --- a/src/checksum/crc24/crc24.cpp +++ b/src/checksum/crc24/crc24.cpp @@ -13,7 +13,7 @@ namespace Botan { /* * Update a CRC24 Checksum */ -void CRC24::add_data(const byte input[], u32bit length) +void CRC24::add_data(const byte input[], size_t length) { const u32bit TABLE[256] = { 0x00000000, 0x00864CFB, 0x008AD50D, 0x000C99F6, 0x0093E6E1, 0x0015AA1A, @@ -82,8 +82,10 @@ void CRC24::add_data(const byte input[], u32bit length) input += 16; length -= 16; } - for(u32bit j = 0; j != length; ++j) - tmp = TABLE[((tmp >> 16) ^ input[j]) & 0xFF] ^ (tmp << 8); + + for(size_t i = 0; i != length; ++i) + tmp = TABLE[((tmp >> 16) ^ input[i]) & 0xFF] ^ (tmp << 8); + crc = tmp; } @@ -92,8 +94,8 @@ void CRC24::add_data(const byte input[], u32bit length) */ void CRC24::final_result(byte output[]) { - for(u32bit j = 0; j != 3; ++j) - output[j] = get_byte(j+1, crc); + for(size_t i = 0; i != 3; ++i) + output[i] = get_byte(i+1, crc); clear(); } diff --git a/src/checksum/crc24/crc24.h b/src/checksum/crc24/crc24.h index 2fc5af2ff..f9786dfa4 100644 --- a/src/checksum/crc24/crc24.h +++ b/src/checksum/crc24/crc24.h @@ -24,7 +24,7 @@ class BOTAN_DLL CRC24 : public HashFunction CRC24() : HashFunction(3) { clear(); } ~CRC24() { clear(); } private: - void add_data(const byte[], u32bit); + void add_data(const byte[], size_t); void final_result(byte[]); u32bit crc; }; diff --git a/src/checksum/crc32/crc32.cpp b/src/checksum/crc32/crc32.cpp index 42462096f..574e13bae 100644 --- a/src/checksum/crc32/crc32.cpp +++ b/src/checksum/crc32/crc32.cpp @@ -13,7 +13,7 @@ namespace Botan { /* * Update a CRC32 Checksum */ -void CRC32::add_data(const byte input[], u32bit length) +void CRC32::add_data(const byte input[], size_t length) { const u32bit TABLE[256] = { 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, @@ -83,8 +83,8 @@ void CRC32::add_data(const byte input[], u32bit length) length -= 16; } - for(u32bit j = 0; j != length; ++j) - tmp = TABLE[(tmp ^ input[j]) & 0xFF] ^ (tmp >> 8); + for(size_t i = 0; i != length; ++i) + tmp = TABLE[(tmp ^ input[i]) & 0xFF] ^ (tmp >> 8); crc = tmp; } diff --git a/src/checksum/crc32/crc32.h b/src/checksum/crc32/crc32.h index 9fd69670d..aa8c366e5 100644 --- a/src/checksum/crc32/crc32.h +++ b/src/checksum/crc32/crc32.h @@ -24,7 +24,7 @@ class BOTAN_DLL CRC32 : public HashFunction CRC32() : HashFunction(4) { clear(); } ~CRC32() { clear(); } private: - void add_data(const byte[], u32bit); + void add_data(const byte[], size_t); void final_result(byte[]); u32bit crc; }; |