aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/hash/md5
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-11 15:28:38 -0500
committerJack Lloyd <[email protected]>2016-12-18 16:48:24 -0500
commitf3cb3edb512bdcab498d825886c3366c341b3f78 (patch)
tree645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/hash/md5
parentc1dd21253c1f3188ff45d3ad47698efd08235ae8 (diff)
Convert to using standard uintN_t integer types
Renames a couple of functions for somewhat better name consistency, eg make_u32bit becomes make_uint32. The old typedefs remain for now since probably lots of application code uses them.
Diffstat (limited to 'src/lib/hash/md5')
-rw-r--r--src/lib/hash/md5/md5.cpp22
-rw-r--r--src/lib/hash/md5/md5.h8
2 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/hash/md5/md5.cpp b/src/lib/hash/md5/md5.cpp
index 439dbde7b..0612ba956 100644
--- a/src/lib/hash/md5/md5.cpp
+++ b/src/lib/hash/md5/md5.cpp
@@ -14,8 +14,8 @@ namespace {
/*
* MD5 FF Function
*/
-inline void FF(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
- byte S, u32bit magic)
+inline void FF(uint32_t& A, uint32_t B, uint32_t C, uint32_t D, uint32_t msg,
+ uint8_t S, uint32_t magic)
{
A += (D ^ (B & (C ^ D))) + msg + magic;
A = rotate_left(A, S) + B;
@@ -24,8 +24,8 @@ inline void FF(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
/*
* MD5 GG Function
*/
-inline void GG(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
- byte S, u32bit magic)
+inline void GG(uint32_t& A, uint32_t B, uint32_t C, uint32_t D, uint32_t msg,
+ uint8_t S, uint32_t magic)
{
A += (C ^ (D & (B ^ C))) + msg + magic;
A = rotate_left(A, S) + B;
@@ -34,8 +34,8 @@ inline void GG(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
/*
* MD5 HH Function
*/
-inline void HH(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
- byte S, u32bit magic)
+inline void HH(uint32_t& A, uint32_t B, uint32_t C, uint32_t D, uint32_t msg,
+ uint8_t S, uint32_t magic)
{
A += (B ^ C ^ D) + msg + magic;
A = rotate_left(A, S) + B;
@@ -44,8 +44,8 @@ inline void HH(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
/*
* MD5 II Function
*/
-inline void II(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
- byte S, u32bit magic)
+inline void II(uint32_t& A, uint32_t B, uint32_t C, uint32_t D, uint32_t msg,
+ uint8_t S, uint32_t magic)
{
A += (C ^ (B | ~D)) + msg + magic;
A = rotate_left(A, S) + B;
@@ -56,9 +56,9 @@ inline void II(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
/*
* MD5 Compression Function
*/
-void MD5::compress_n(const byte input[], size_t blocks)
+void MD5::compress_n(const uint8_t input[], size_t blocks)
{
- u32bit A = m_digest[0], B = m_digest[1], C = m_digest[2], D = m_digest[3];
+ uint32_t A = m_digest[0], B = m_digest[1], C = m_digest[2], D = m_digest[3];
for(size_t i = 0; i != blocks; ++i)
{
@@ -112,7 +112,7 @@ void MD5::compress_n(const byte input[], size_t blocks)
/*
* Copy out the digest
*/
-void MD5::copy_out(byte output[])
+void MD5::copy_out(uint8_t output[])
{
copy_out_vec_le(output, output_length(), m_digest);
}
diff --git a/src/lib/hash/md5/md5.h b/src/lib/hash/md5/md5.h
index bbeffee50..13a423594 100644
--- a/src/lib/hash/md5/md5.h
+++ b/src/lib/hash/md5/md5.h
@@ -27,19 +27,19 @@ class BOTAN_DLL MD5 final : public MDx_HashFunction
MD5() : MDx_HashFunction(64, false, true), m_M(16), m_digest(4)
{ clear(); }
protected:
- void compress_n(const byte[], size_t blocks) override;
- void copy_out(byte[]) override;
+ void compress_n(const uint8_t[], size_t blocks) override;
+ void copy_out(uint8_t[]) override;
private:
/**
* The message buffer
*/
- secure_vector<u32bit> m_M;
+ secure_vector<uint32_t> m_M;
/**
* The digest value
*/
- secure_vector<u32bit> m_digest;
+ secure_vector<uint32_t> m_digest;
};
}