~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to extra/yassl/taocrypt/include/md2.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
   Copyright (C) 2000-2007 MySQL AB
 
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
/* md2.hpp provides MD2 digest support, see RFC 1319
 
20
*/
 
21
 
 
22
#ifndef TAO_CRYPT_MD2_HPP
 
23
#define TAO_CRYPT_MD2_HPP
 
24
 
 
25
 
 
26
#include "hash.hpp"
 
27
#include "block.hpp"
 
28
 
 
29
 
 
30
namespace TaoCrypt {
 
31
 
 
32
 
 
33
// MD2 digest
 
34
class MD2 : public HASH {
 
35
public:
 
36
    enum { BLOCK_SIZE = 16, DIGEST_SIZE = 16, PAD_SIZE = 16, X_SIZE = 48 };
 
37
    MD2();
 
38
 
 
39
    word32 getBlockSize()  const { return BLOCK_SIZE; }
 
40
    word32 getDigestSize() const { return DIGEST_SIZE; }
 
41
 
 
42
    void Update(const byte*, word32);
 
43
    void Final(byte*);
 
44
 
 
45
    void Init();
 
46
    void Swap(MD2&);
 
47
private:
 
48
    ByteBlock X_, C_, buffer_;
 
49
    word32    count_;           // bytes % PAD_SIZE
 
50
 
 
51
    MD2(const MD2&);
 
52
    MD2& operator=(const MD2&);
 
53
};
 
54
 
 
55
inline void swap(MD2& a, MD2& b)
 
56
{
 
57
    a.Swap(b);
 
58
}
 
59
 
 
60
 
 
61
} // namespace
 
62
 
 
63
#endif // TAO_CRYPT_MD2_HPP
 
64