aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/hash/rmd128/rmd128.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-07-17 11:55:26 -0400
committerJack Lloyd <[email protected]>2016-09-02 05:28:13 -0400
commita5a260ca52efb43083d654805dce773580102cb9 (patch)
treeb9e28f43641de4db4ca377359fc7290aa643aed3 /src/lib/hash/rmd128/rmd128.cpp
parent1c0bc3cc6bcbd6318d8ae33d0442ffd24302a044 (diff)
Remove deprecated hashes MD2, HAS-160, and RIPEMD-128
Diffstat (limited to 'src/lib/hash/rmd128/rmd128.cpp')
-rw-r--r--src/lib/hash/rmd128/rmd128.cpp173
1 files changed, 0 insertions, 173 deletions
diff --git a/src/lib/hash/rmd128/rmd128.cpp b/src/lib/hash/rmd128/rmd128.cpp
deleted file mode 100644
index e520fa0c3..000000000
--- a/src/lib/hash/rmd128/rmd128.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
-* RIPEMD-128
-* (C) 1999-2007 Jack Lloyd
-*
-* Botan is released under the Simplified BSD License (see license.txt)
-*/
-
-#include <botan/rmd128.h>
-
-namespace Botan {
-
-namespace RIPEMD_128_F {
-
-/*
-* RIPEMD-128 F1 Function
-*/
-inline void F1(u32bit& A, u32bit B, u32bit C, u32bit D,
- u32bit msg, u32bit shift)
- {
- A += (B ^ C ^ D) + msg;
- A = rotate_left(A, shift);
- }
-
-/*
-* RIPEMD-128 F2 Function
-*/
-inline void F2(u32bit& A, u32bit B, u32bit C, u32bit D,
- u32bit msg, u32bit shift, u32bit magic)
- {
- A += (D ^ (B & (C ^ D))) + msg + magic;
- A = rotate_left(A, shift);
- }
-
-/*
-* RIPEMD-128 F3 Function
-*/
-inline void F3(u32bit& A, u32bit B, u32bit C, u32bit D,
- u32bit msg, u32bit shift, u32bit magic)
- {
- A += (D ^ (B | ~C)) + msg + magic;
- A = rotate_left(A, shift);
- }
-
-/*
-* RIPEMD-128 F4 Function
-*/
-inline void F4(u32bit& A, u32bit B, u32bit C, u32bit D,
- u32bit msg, u32bit shift, u32bit magic)
- {
- A += (C ^ (D & (B ^ C))) + msg + magic;
- A = rotate_left(A, shift);
- }
-
-}
-
-/*
-* RIPEMD-128 Compression Function
-*/
-void RIPEMD_128::compress_n(const byte input[], size_t blocks)
- {
- using namespace RIPEMD_128_F;
-
- const u32bit MAGIC2 = 0x5A827999, MAGIC3 = 0x6ED9EBA1,
- MAGIC4 = 0x8F1BBCDC, MAGIC5 = 0x50A28BE6,
- MAGIC6 = 0x5C4DD124, MAGIC7 = 0x6D703EF3;
-
- for(size_t i = 0; i != blocks; ++i)
- {
- load_le(m_M.data(), input, m_M.size());
-
- u32bit A1 = m_digest[0], A2 = A1, B1 = m_digest[1], B2 = B1,
- C1 = m_digest[2], C2 = C1, D1 = m_digest[3], D2 = D1;
-
- F1(A1,B1,C1,D1,m_M[ 0],11 ); F4(A2,B2,C2,D2,m_M[ 5], 8,MAGIC5);
- F1(D1,A1,B1,C1,m_M[ 1],14 ); F4(D2,A2,B2,C2,m_M[14], 9,MAGIC5);
- F1(C1,D1,A1,B1,m_M[ 2],15 ); F4(C2,D2,A2,B2,m_M[ 7], 9,MAGIC5);
- F1(B1,C1,D1,A1,m_M[ 3],12 ); F4(B2,C2,D2,A2,m_M[ 0],11,MAGIC5);
- F1(A1,B1,C1,D1,m_M[ 4], 5 ); F4(A2,B2,C2,D2,m_M[ 9],13,MAGIC5);
- F1(D1,A1,B1,C1,m_M[ 5], 8 ); F4(D2,A2,B2,C2,m_M[ 2],15,MAGIC5);
- F1(C1,D1,A1,B1,m_M[ 6], 7 ); F4(C2,D2,A2,B2,m_M[11],15,MAGIC5);
- F1(B1,C1,D1,A1,m_M[ 7], 9 ); F4(B2,C2,D2,A2,m_M[ 4], 5,MAGIC5);
- F1(A1,B1,C1,D1,m_M[ 8],11 ); F4(A2,B2,C2,D2,m_M[13], 7,MAGIC5);
- F1(D1,A1,B1,C1,m_M[ 9],13 ); F4(D2,A2,B2,C2,m_M[ 6], 7,MAGIC5);
- F1(C1,D1,A1,B1,m_M[10],14 ); F4(C2,D2,A2,B2,m_M[15], 8,MAGIC5);
- F1(B1,C1,D1,A1,m_M[11],15 ); F4(B2,C2,D2,A2,m_M[ 8],11,MAGIC5);
- F1(A1,B1,C1,D1,m_M[12], 6 ); F4(A2,B2,C2,D2,m_M[ 1],14,MAGIC5);
- F1(D1,A1,B1,C1,m_M[13], 7 ); F4(D2,A2,B2,C2,m_M[10],14,MAGIC5);
- F1(C1,D1,A1,B1,m_M[14], 9 ); F4(C2,D2,A2,B2,m_M[ 3],12,MAGIC5);
- F1(B1,C1,D1,A1,m_M[15], 8 ); F4(B2,C2,D2,A2,m_M[12], 6,MAGIC5);
-
- F2(A1,B1,C1,D1,m_M[ 7], 7,MAGIC2); F3(A2,B2,C2,D2,m_M[ 6], 9,MAGIC6);
- F2(D1,A1,B1,C1,m_M[ 4], 6,MAGIC2); F3(D2,A2,B2,C2,m_M[11],13,MAGIC6);
- F2(C1,D1,A1,B1,m_M[13], 8,MAGIC2); F3(C2,D2,A2,B2,m_M[ 3],15,MAGIC6);
- F2(B1,C1,D1,A1,m_M[ 1],13,MAGIC2); F3(B2,C2,D2,A2,m_M[ 7], 7,MAGIC6);
- F2(A1,B1,C1,D1,m_M[10],11,MAGIC2); F3(A2,B2,C2,D2,m_M[ 0],12,MAGIC6);
- F2(D1,A1,B1,C1,m_M[ 6], 9,MAGIC2); F3(D2,A2,B2,C2,m_M[13], 8,MAGIC6);
- F2(C1,D1,A1,B1,m_M[15], 7,MAGIC2); F3(C2,D2,A2,B2,m_M[ 5], 9,MAGIC6);
- F2(B1,C1,D1,A1,m_M[ 3],15,MAGIC2); F3(B2,C2,D2,A2,m_M[10],11,MAGIC6);
- F2(A1,B1,C1,D1,m_M[12], 7,MAGIC2); F3(A2,B2,C2,D2,m_M[14], 7,MAGIC6);
- F2(D1,A1,B1,C1,m_M[ 0],12,MAGIC2); F3(D2,A2,B2,C2,m_M[15], 7,MAGIC6);
- F2(C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B2,C2,m_M[ 8],13,MAGIC7);
- F3(C1,D1,A1,B1,m_M[ 0],13,MAGIC3); F2(C2,D2,A2,B2,m_M[12], 5,MAGIC7);
- F3(B1,C1,D1,A1,m_M[ 6], 6,MAGIC3); F2(B2,C2,D2,A2,m_M[ 2],14,MAGIC7);
- F3(A1,B1,C1,D1,m_M[13], 5,MAGIC3); F2(A2,B2,C2,D2,m_M[10],13,MAGIC7);
- F3(D1,A1,B1,C1,m_M[11],12,MAGIC3); F2(D2,A2,B2,C2,m_M[ 0],13,MAGIC7);
- F3(C1,D1,A1,B1,m_M[ 5], 7,MAGIC3); F2(C2,D2,A2,B2,m_M[ 4], 7,MAGIC7);
- F3(B1,C1,D1,A1,m_M[12], 5,MAGIC3); F2(B2,C2,D2,A2,m_M[13], 5,MAGIC7);
-
- F4(A1,B1,C1,D1,m_M[ 1],11,MAGIC4); F1(A2,B2,C2,D2,m_M[ 8],15 );
- F4(D1,A1,B1,C1,m_M[ 9],12,MAGIC4); F1(D2,A2,B2,C2,m_M[ 6], 5 );
- F4(C1,D1,A1,B1,m_M[11],14,MAGIC4); F1(C2,D2,A2,B2,m_M[ 4], 8 );
- F4(B1,C1,D1,A1,m_M[10],15,MAGIC4); F1(B2,C2,D2,A2,m_M[ 1],11 );
- F4(A1,B1,C1,D1,m_M[ 0],14,MAGIC4); F1(A2,B2,C2,D2,m_M[ 3],14 );
- F4(D1,A1,B1,C1,m_M[ 8],15,MAGIC4); F1(D2,A2,B2,C2,m_M[11],14 );
- F4(C1,D1,A1,B1,m_M[12], 9,MAGIC4); F1(C2,D2,A2,B2,m_M[15], 6 );
- F4(B1,C1,D1,A1,m_M[ 4], 8,MAGIC4); F1(B2,C2,D2,A2,m_M[ 0],14 );
- F4(A1,B1,C1,D1,m_M[13], 9,MAGIC4); F1(A2,B2,C2,D2,m_M[ 5], 6 );
- F4(D1,A1,B1,C1,m_M[ 3],14,MAGIC4); F1(D2,A2,B2,C2,m_M[12], 9 );
- F4(C1,D1,A1,B1,m_M[ 7], 5,MAGIC4); F1(C2,D2,A2,B2,m_M[ 2],12 );
- F4(B1,C1,D1,A1,m_M[15], 6,MAGIC4); F1(B2,C2,D2,A2,m_M[13], 9 );
- F4(A1,B1,C1,D1,m_M[14], 8,MAGIC4); F1(A2,B2,C2,D2,m_M[ 9],12 );
- F4(D1,A1,B1,C1,m_M[ 5], 6,MAGIC4); F1(D2,A2,B2,C2,m_M[ 7], 5 );
- F4(C1,D1,A1,B1,m_M[ 6], 5,MAGIC4); F1(C2,D2,A2,B2,m_M[10],15 );
- F4(B1,C1,D1,A1,m_M[ 2],12,MAGIC4); F1(B2,C2,D2,A2,m_M[14], 8 );
-
- D2 = m_digest[1] + C1 + D2;
- m_digest[1] = m_digest[2] + D1 + A2;
- m_digest[2] = m_digest[3] + A1 + B2;
- m_digest[3] = m_digest[0] + B1 + C2;
- m_digest[0] = D2;
-
- input += hash_block_size();
- }
- }
-
-/*
-* Copy out the digest
-*/
-void RIPEMD_128::copy_out(byte output[])
- {
- copy_out_vec_le(output, output_length(), m_digest);
- }
-
-/*
-* Clear memory of sensitive data
-*/
-void RIPEMD_128::clear()
- {
- MDx_HashFunction::clear();
- zeroise(m_M);
- m_digest[0] = 0x67452301;
- m_digest[1] = 0xEFCDAB89;
- m_digest[2] = 0x98BADCFE;
- m_digest[3] = 0x10325476;
- }
-
-}