diff options
author | lloyd <[email protected]> | 2010-10-12 23:29:55 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-12 23:29:55 +0000 |
commit | 2af9ba577730f071eef44b3ba492c3bfad0a8ec6 (patch) | |
tree | 92a4c4e973756225d42bb99a99110b2669be7299 /src/hash/mdx_hash | |
parent | 97e8d6086171772cd5e45bcf2f5b1ea1e38e6bf5 (diff) |
Use size_t for BufferedComputation::add_data
Diffstat (limited to 'src/hash/mdx_hash')
-rw-r--r-- | src/hash/mdx_hash/mdx_hash.cpp | 14 | ||||
-rw-r--r-- | src/hash/mdx_hash/mdx_hash.h | 12 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/hash/mdx_hash/mdx_hash.cpp b/src/hash/mdx_hash/mdx_hash.cpp index 560832542..cea66044b 100644 --- a/src/hash/mdx_hash/mdx_hash.cpp +++ b/src/hash/mdx_hash/mdx_hash.cpp @@ -14,9 +14,9 @@ namespace Botan { /* * MDx_HashFunction Constructor */ -MDx_HashFunction::MDx_HashFunction(u32bit hash_len, u32bit block_len, +MDx_HashFunction::MDx_HashFunction(size_t hash_len, size_t block_len, bool byte_end, bool bit_end, - u32bit cnt_size) : + size_t cnt_size) : HashFunction(hash_len, block_len), buffer(block_len), BIG_BYTE_ENDIAN(byte_end), BIG_BIT_ENDIAN(bit_end), COUNT_SIZE(cnt_size) { @@ -37,7 +37,7 @@ void MDx_HashFunction::clear() /* * Update the hash */ -void MDx_HashFunction::add_data(const byte input[], u32bit length) +void MDx_HashFunction::add_data(const byte input[], size_t length) { count += length; @@ -54,8 +54,8 @@ void MDx_HashFunction::add_data(const byte input[], u32bit length) } } - const u32bit full_blocks = length / HASH_BLOCK_SIZE; - const u32bit remaining = length % HASH_BLOCK_SIZE; + const size_t full_blocks = length / HASH_BLOCK_SIZE; + const size_t remaining = length % HASH_BLOCK_SIZE; if(full_blocks) compress_n(input, full_blocks); @@ -70,8 +70,8 @@ void MDx_HashFunction::add_data(const byte input[], u32bit length) void MDx_HashFunction::final_result(byte output[]) { buffer[position] = (BIG_BIT_ENDIAN ? 0x80 : 0x01); - for(u32bit j = position+1; j != HASH_BLOCK_SIZE; ++j) - buffer[j] = 0; + for(size_t i = position+1; i != HASH_BLOCK_SIZE; ++i) + buffer[i] = 0; if(position >= HASH_BLOCK_SIZE - COUNT_SIZE) { diff --git a/src/hash/mdx_hash/mdx_hash.h b/src/hash/mdx_hash/mdx_hash.h index 087c7fc46..6603f54bc 100644 --- a/src/hash/mdx_hash/mdx_hash.h +++ b/src/hash/mdx_hash/mdx_hash.h @@ -25,15 +25,15 @@ class BOTAN_DLL MDx_HashFunction : public HashFunction * @param big_bit_endian specifies if the hash uses big-endian bits * @param counter_size specifies the size of the counter var in bytes */ - MDx_HashFunction(u32bit hash_length, - u32bit block_length, + MDx_HashFunction(size_t hash_length, + size_t block_length, bool big_byte_endian, bool big_bit_endian, - u32bit counter_size = 8); + size_t counter_size = 8); virtual ~MDx_HashFunction() {} protected: - void add_data(const byte input[], u32bit length); + void add_data(const byte input[], size_t length); void final_result(byte output[]); /** @@ -41,7 +41,7 @@ class BOTAN_DLL MDx_HashFunction : public HashFunction * @param blocks the input * @param block_n the number of blocks */ - virtual void compress_n(const byte blocks[], u32bit block_n) = 0; + virtual void compress_n(const byte blocks[], size_t block_n) = 0; void clear(); @@ -59,7 +59,7 @@ class BOTAN_DLL MDx_HashFunction : public HashFunction private: SecureVector<byte> buffer; u64bit count; - u32bit position; + size_t position; const bool BIG_BYTE_ENDIAN, BIG_BIT_ENDIAN; const u32bit COUNT_SIZE; |