Botan  1.11.15
src/lib/hash/md2/md2.h
Go to the documentation of this file.
00001 /*
00002 * MD2
00003 * (C) 1999-2007 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_MD2_H__
00009 #define BOTAN_MD2_H__
00010 
00011 #include <botan/hash.h>
00012 
00013 namespace Botan {
00014 
00015 /**
00016 * MD2
00017 */
00018 class BOTAN_DLL MD2 : public HashFunction
00019    {
00020    public:
00021       std::string name() const { return "MD2"; }
00022       size_t output_length() const { return 16; }
00023       size_t hash_block_size() const { return 16; }
00024       HashFunction* clone() const { return new MD2; }
00025 
00026       void clear();
00027 
00028       MD2() : X(48), checksum(16), buffer(16)
00029          { clear(); }
00030    private:
00031       void add_data(const byte[], size_t);
00032       void hash(const byte[]);
00033       void final_result(byte[]);
00034 
00035       secure_vector<byte> X, checksum, buffer;
00036       size_t position;
00037    };
00038 
00039 }
00040 
00041 #endif