MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
md4.hpp
1 /*
2  Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; see the file COPYING. If not, write to the
15  Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
16  MA 02110-1301 USA.
17 */
18 
19 /* md4.hpp provides MD4 digest support
20  * WANRING: MD4 is considered insecure, only use if you have to, e.g., yaSSL
21  * libcurl supports needs this for NTLM authentication
22 */
23 
24 #ifndef TAO_CRYPT_MD4_HPP
25 #define TAO_CRYPT_MD4_HPP
26 
27 #include "hash.hpp"
28 
29 namespace TaoCrypt {
30 
31 
32 // MD4 digest
33 class MD4 : public HASHwithTransform {
34 public:
35  enum { BLOCK_SIZE = 64, DIGEST_SIZE = 16, PAD_SIZE = 56,
36  TAO_BYTE_ORDER = LittleEndianOrder }; // in Bytes
37  MD4() : HASHwithTransform(DIGEST_SIZE / sizeof(word32), BLOCK_SIZE)
38  { Init(); }
39  ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); }
40  word32 getBlockSize() const { return BLOCK_SIZE; }
41  word32 getDigestSize() const { return DIGEST_SIZE; }
42  word32 getPadSize() const { return PAD_SIZE; }
43 
44  MD4(const MD4&);
45  MD4& operator= (const MD4&);
46 
47  void Init();
48  void Swap(MD4&);
49 private:
50  void Transform();
51 };
52 
53 inline void swap(MD4& a, MD4& b)
54 {
55  a.Swap(b);
56 }
57 
58 
59 } // namespace
60 
61 #endif // TAO_CRYPT_MD4_HPP
62