aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/hash/mdx_hash
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-18 16:53:10 -0500
committerJack Lloyd <[email protected]>2016-12-18 16:53:25 -0500
commit5eca80aa3336dc49c721e9c6404f531f2e290537 (patch)
tree645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/hash/mdx_hash
parentc1dd21253c1f3188ff45d3ad47698efd08235ae8 (diff)
parentf3cb3edb512bdcab498d825886c3366c341b3f78 (diff)
Merge GH #771 Use cstdint integer types
Diffstat (limited to 'src/lib/hash/mdx_hash')
-rw-r--r--src/lib/hash/mdx_hash/mdx_hash.cpp8
-rw-r--r--src/lib/hash/mdx_hash/mdx_hash.h14
2 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/hash/mdx_hash/mdx_hash.cpp b/src/lib/hash/mdx_hash/mdx_hash.cpp
index f21b4ac34..c2fb320ec 100644
--- a/src/lib/hash/mdx_hash/mdx_hash.cpp
+++ b/src/lib/hash/mdx_hash/mdx_hash.cpp
@@ -38,7 +38,7 @@ void MDx_HashFunction::clear()
/*
* Update the hash
*/
-void MDx_HashFunction::add_data(const byte input[], size_t length)
+void MDx_HashFunction::add_data(const uint8_t input[], size_t length)
{
m_count += length;
@@ -68,7 +68,7 @@ void MDx_HashFunction::add_data(const byte input[], size_t length)
/*
* Finalize a hash
*/
-void MDx_HashFunction::final_result(byte output[])
+void MDx_HashFunction::final_result(uint8_t output[])
{
m_buffer[m_position] = (BIG_BIT_ENDIAN ? 0x80 : 0x01);
for(size_t i = m_position+1; i != m_buffer.size(); ++i)
@@ -90,14 +90,14 @@ void MDx_HashFunction::final_result(byte output[])
/*
* Write the count bits to the buffer
*/
-void MDx_HashFunction::write_count(byte out[])
+void MDx_HashFunction::write_count(uint8_t out[])
{
if(COUNT_SIZE < 8)
throw Invalid_State("MDx_HashFunction::write_count: COUNT_SIZE < 8");
if(COUNT_SIZE >= output_length() || COUNT_SIZE >= hash_block_size())
throw Invalid_Argument("MDx_HashFunction: COUNT_SIZE is too big");
- const u64bit bit_count = m_count * 8;
+ const uint64_t bit_count = m_count * 8;
if(BIG_BYTE_ENDIAN)
store_be(bit_count, out + COUNT_SIZE - 8);
diff --git a/src/lib/hash/mdx_hash/mdx_hash.h b/src/lib/hash/mdx_hash/mdx_hash.h
index 4b2f9bad0..649cf387d 100644
--- a/src/lib/hash/mdx_hash/mdx_hash.h
+++ b/src/lib/hash/mdx_hash/mdx_hash.h
@@ -31,15 +31,15 @@ class BOTAN_DLL MDx_HashFunction : public HashFunction
size_t hash_block_size() const override { return m_buffer.size(); }
protected:
- void add_data(const byte input[], size_t length) override;
- void final_result(byte output[]) override;
+ void add_data(const uint8_t input[], size_t length) override;
+ void final_result(uint8_t output[]) override;
/**
* Run the hash's compression function over a set of blocks
* @param blocks the input
* @param block_n the number of blocks
*/
- virtual void compress_n(const byte blocks[], size_t block_n) = 0;
+ virtual void compress_n(const uint8_t blocks[], size_t block_n) = 0;
void clear() override;
@@ -47,16 +47,16 @@ class BOTAN_DLL MDx_HashFunction : public HashFunction
* Copy the output to the buffer
* @param buffer to put the output into
*/
- virtual void copy_out(byte buffer[]) = 0;
+ virtual void copy_out(uint8_t buffer[]) = 0;
/**
* Write the count, if used, to this spot
* @param out where to write the counter to
*/
- virtual void write_count(byte out[]);
+ virtual void write_count(uint8_t out[]);
private:
- secure_vector<byte> m_buffer;
- u64bit m_count;
+ secure_vector<uint8_t> m_buffer;
+ uint64_t m_count;
size_t m_position;
const bool BIG_BYTE_ENDIAN, BIG_BIT_ENDIAN;