From 63121e1e169616f724bf79b8aac1a2b4423c8904 Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 13 Oct 2010 02:45:00 +0000 Subject: Use output_length() instead of OUTPUT_LENGTH pseudo-property --- src/hash/bmw/bmw_512.cpp | 2 +- src/hash/comb4p/comb4p.cpp | 4 ++-- src/hash/has160/has160.cpp | 2 +- src/hash/md2/md2.cpp | 2 +- src/hash/md4/md4.cpp | 2 +- src/hash/md5/md5.cpp | 2 +- src/hash/mdx_hash/mdx_hash.cpp | 2 +- src/hash/par_hash/par_hash.cpp | 4 ++-- src/hash/rmd128/rmd128.cpp | 2 +- src/hash/rmd160/rmd160.cpp | 2 +- src/hash/sha1/sha160.cpp | 2 +- src/hash/sha2_32/sha2_32.cpp | 4 ++-- src/hash/sha2_64/sha2_64.cpp | 4 ++-- src/hash/tiger/tiger.cpp | 8 ++++---- src/hash/tiger/tiger.h | 2 +- src/hash/whirlpool/whrlpool.cpp | 2 +- 16 files changed, 23 insertions(+), 23 deletions(-) (limited to 'src/hash') diff --git a/src/hash/bmw/bmw_512.cpp b/src/hash/bmw/bmw_512.cpp index a69d23bff..3999cb95c 100644 --- a/src/hash/bmw/bmw_512.cpp +++ b/src/hash/bmw/bmw_512.cpp @@ -168,7 +168,7 @@ void BMW_512::copy_out(byte output[]) BMW_512_compress(final, &H[0], &Q[0]); - for(size_t i = 0; i != OUTPUT_LENGTH; i += 8) + for(size_t i = 0; i != output_length(); i += 8) store_le(final[8 + i/8], output + i); } diff --git a/src/hash/comb4p/comb4p.cpp b/src/hash/comb4p/comb4p.cpp index 681e20685..c4cd1cc79 100644 --- a/src/hash/comb4p/comb4p.cpp +++ b/src/hash/comb4p/comb4p.cpp @@ -48,14 +48,14 @@ void comb4p_round(MemoryRegion& out, } Comb4P::Comb4P(HashFunction* h1, HashFunction* h2) : - HashFunction(h1->OUTPUT_LENGTH + h2->OUTPUT_LENGTH, + HashFunction(h1->output_length() + h2->output_length(), comb4p_block_size(h1, h2)), hash1(h1), hash2(h2) { if(hash1->name() == hash2->name()) throw std::invalid_argument("Comb4P: Must use two distinct hashes"); - if(hash1->OUTPUT_LENGTH != hash2->OUTPUT_LENGTH) + if(hash1->output_length() != hash2->output_length()) throw std::invalid_argument("Comb4P: Incompatible hashes " + hash1->name() + " and " + hash2->name()); diff --git a/src/hash/has160/has160.cpp b/src/hash/has160/has160.cpp index 4f8db53f7..72246a845 100644 --- a/src/hash/has160/has160.cpp +++ b/src/hash/has160/has160.cpp @@ -144,7 +144,7 @@ void HAS_160::compress_n(const byte input[], size_t blocks) */ void HAS_160::copy_out(byte output[]) { - for(size_t i = 0; i != OUTPUT_LENGTH; i += 4) + for(size_t i = 0; i != output_length(); i += 4) store_le(digest[i/4], output + i); } diff --git a/src/hash/md2/md2.cpp b/src/hash/md2/md2.cpp index 5d8f5f15c..f2d6d800b 100644 --- a/src/hash/md2/md2.cpp +++ b/src/hash/md2/md2.cpp @@ -94,7 +94,7 @@ void MD2::final_result(byte output[]) hash(&buffer[0]); hash(&checksum[0]); - copy_mem(output, &X[0], OUTPUT_LENGTH); + copy_mem(output, &X[0], output_length()); clear(); } diff --git a/src/hash/md4/md4.cpp b/src/hash/md4/md4.cpp index 3f9259deb..2b24d10fd 100644 --- a/src/hash/md4/md4.cpp +++ b/src/hash/md4/md4.cpp @@ -94,7 +94,7 @@ void MD4::compress_n(const byte input[], size_t blocks) */ void MD4::copy_out(byte output[]) { - for(size_t i = 0; i != OUTPUT_LENGTH; i += 4) + for(size_t i = 0; i != output_length(); i += 4) store_le(digest[i/4], output + i); } diff --git a/src/hash/md5/md5.cpp b/src/hash/md5/md5.cpp index 69ab89e63..9a5f95ca8 100644 --- a/src/hash/md5/md5.cpp +++ b/src/hash/md5/md5.cpp @@ -116,7 +116,7 @@ void MD5::compress_n(const byte input[], size_t blocks) */ void MD5::copy_out(byte output[]) { - for(size_t i = 0; i != OUTPUT_LENGTH; i += 4) + for(size_t i = 0; i != output_length(); i += 4) store_le(digest[i/4], output + i); } diff --git a/src/hash/mdx_hash/mdx_hash.cpp b/src/hash/mdx_hash/mdx_hash.cpp index cea66044b..9bf6b573a 100644 --- a/src/hash/mdx_hash/mdx_hash.cpp +++ b/src/hash/mdx_hash/mdx_hash.cpp @@ -20,7 +20,7 @@ MDx_HashFunction::MDx_HashFunction(size_t hash_len, size_t block_len, HashFunction(hash_len, block_len), buffer(block_len), BIG_BYTE_ENDIAN(byte_end), BIG_BIT_ENDIAN(bit_end), COUNT_SIZE(cnt_size) { - if(COUNT_SIZE >= OUTPUT_LENGTH || COUNT_SIZE >= HASH_BLOCK_SIZE) + if(COUNT_SIZE >= output_length() || COUNT_SIZE >= HASH_BLOCK_SIZE) throw Invalid_Argument("MDx_HashFunction: COUNT_SIZE is too big"); count = position = 0; } diff --git a/src/hash/par_hash/par_hash.cpp b/src/hash/par_hash/par_hash.cpp index 794166327..aef5f8247 100644 --- a/src/hash/par_hash/par_hash.cpp +++ b/src/hash/par_hash/par_hash.cpp @@ -19,7 +19,7 @@ size_t sum_of_hash_lengths(const std::vector& hashes) size_t sum = 0; for(size_t i = 0; i != hashes.size(); ++i) - sum += hashes[i]->OUTPUT_LENGTH; + sum += hashes[i]->output_length(); return sum; } @@ -44,7 +44,7 @@ void Parallel::final_result(byte hash[]) for(size_t i = 0; i != hashes.size(); ++i) { hashes[i]->final(hash + offset); - offset += hashes[i]->OUTPUT_LENGTH; + offset += hashes[i]->output_length(); } } diff --git a/src/hash/rmd128/rmd128.cpp b/src/hash/rmd128/rmd128.cpp index 61737a4a0..edbe9fa84 100644 --- a/src/hash/rmd128/rmd128.cpp +++ b/src/hash/rmd128/rmd128.cpp @@ -156,7 +156,7 @@ void RIPEMD_128::compress_n(const byte input[], size_t blocks) */ void RIPEMD_128::copy_out(byte output[]) { - for(size_t i = 0; i != OUTPUT_LENGTH; i += 4) + for(size_t i = 0; i != output_length(); i += 4) store_le(digest[i/4], output + i); } diff --git a/src/hash/rmd160/rmd160.cpp b/src/hash/rmd160/rmd160.cpp index 255f3f95a..c3ae7119b 100644 --- a/src/hash/rmd160/rmd160.cpp +++ b/src/hash/rmd160/rmd160.cpp @@ -189,7 +189,7 @@ void RIPEMD_160::compress_n(const byte input[], size_t blocks) */ void RIPEMD_160::copy_out(byte output[]) { - for(size_t i = 0; i != OUTPUT_LENGTH; i += 4) + for(size_t i = 0; i != output_length(); i += 4) store_le(digest[i/4], output + i); } diff --git a/src/hash/sha1/sha160.cpp b/src/hash/sha1/sha160.cpp index 6c98b21d2..4778e5765 100644 --- a/src/hash/sha1/sha160.cpp +++ b/src/hash/sha1/sha160.cpp @@ -134,7 +134,7 @@ void SHA_160::compress_n(const byte input[], size_t blocks) */ void SHA_160::copy_out(byte output[]) { - for(size_t i = 0; i != OUTPUT_LENGTH; i += 4) + for(size_t i = 0; i != output_length(); i += 4) store_be(digest[i/4], output + i); } diff --git a/src/hash/sha2_32/sha2_32.cpp b/src/hash/sha2_32/sha2_32.cpp index 6bbf6dec9..4e5f2b38c 100644 --- a/src/hash/sha2_32/sha2_32.cpp +++ b/src/hash/sha2_32/sha2_32.cpp @@ -171,7 +171,7 @@ void SHA_224::compress_n(const byte input[], size_t blocks) */ void SHA_224::copy_out(byte output[]) { - for(size_t i = 0; i != OUTPUT_LENGTH; i += 4) + for(size_t i = 0; i != output_length(); i += 4) store_be(digest[i/4], output + i); } @@ -205,7 +205,7 @@ void SHA_256::compress_n(const byte input[], size_t blocks) */ void SHA_256::copy_out(byte output[]) { - for(size_t i = 0; i != OUTPUT_LENGTH; i += 4) + for(size_t i = 0; i != output_length(); i += 4) store_be(digest[i/4], output + i); } diff --git a/src/hash/sha2_64/sha2_64.cpp b/src/hash/sha2_64/sha2_64.cpp index 96e672819..3c1df9be6 100644 --- a/src/hash/sha2_64/sha2_64.cpp +++ b/src/hash/sha2_64/sha2_64.cpp @@ -178,7 +178,7 @@ void SHA_384::compress_n(const byte input[], size_t blocks) */ void SHA_384::copy_out(byte output[]) { - for(size_t i = 0; i != OUTPUT_LENGTH; i += 8) + for(size_t i = 0; i != output_length(); i += 8) store_be(digest[i/8], output + i); } @@ -212,7 +212,7 @@ void SHA_512::compress_n(const byte input[], size_t blocks) */ void SHA_512::copy_out(byte output[]) { - for(size_t i = 0; i != OUTPUT_LENGTH; i += 8) + for(size_t i = 0; i != output_length(); i += 8) store_be(digest[i/8], output + i); } diff --git a/src/hash/tiger/tiger.cpp b/src/hash/tiger/tiger.cpp index fa5effd80..67baf8d19 100644 --- a/src/hash/tiger/tiger.cpp +++ b/src/hash/tiger/tiger.cpp @@ -75,7 +75,7 @@ void Tiger::compress_n(const byte input[], size_t blocks) */ void Tiger::copy_out(byte output[]) { - for(size_t i = 0; i != OUTPUT_LENGTH; ++i) + for(size_t i = 0; i != output_length(); ++i) output[i] = get_byte(7 - (i % 8), digest[i/8]); } @@ -160,7 +160,7 @@ void Tiger::clear() */ std::string Tiger::name() const { - return "Tiger(" + to_string(OUTPUT_LENGTH) + "," + to_string(PASS) + ")"; + return "Tiger(" + to_string(output_length()) + "," + to_string(PASS) + ")"; } /* @@ -172,9 +172,9 @@ Tiger::Tiger(size_t hashlen, size_t pass) : digest(3), PASS(pass) { - if(OUTPUT_LENGTH != 16 && OUTPUT_LENGTH != 20 && OUTPUT_LENGTH != 24) + if(output_length() != 16 && output_length() != 20 && output_length() != 24) throw Invalid_Argument("Tiger: Illegal hash output size: " + - to_string(OUTPUT_LENGTH)); + to_string(output_length())); if(PASS < 3) throw Invalid_Argument("Tiger: Invalid number of passes: " + to_string(PASS)); diff --git a/src/hash/tiger/tiger.h b/src/hash/tiger/tiger.h index 7305ddb46..7d753c237 100644 --- a/src/hash/tiger/tiger.h +++ b/src/hash/tiger/tiger.h @@ -23,7 +23,7 @@ class BOTAN_DLL Tiger : public MDx_HashFunction HashFunction* clone() const { - return new Tiger(OUTPUT_LENGTH, PASS); + return new Tiger(output_length(), PASS); } /** diff --git a/src/hash/whirlpool/whrlpool.cpp b/src/hash/whirlpool/whrlpool.cpp index fdbdf5d0f..bff4b27ad 100644 --- a/src/hash/whirlpool/whrlpool.cpp +++ b/src/hash/whirlpool/whrlpool.cpp @@ -129,7 +129,7 @@ void Whirlpool::compress_n(const byte in[], size_t blocks) */ void Whirlpool::copy_out(byte output[]) { - for(size_t i = 0; i != OUTPUT_LENGTH; i += 8) + for(size_t i = 0; i != output_length(); i += 8) store_be(digest[i/8], output + i); } -- cgit v1.2.3