00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef DDTMD_H
00014 #define DDTMD_H
00015
00016
00017 #ifdef HAVE_CONFIG_H
00018 #include "config.h"
00019 #endif
00020
00021 extern "C"
00022 {
00023 #include <stddef.h>
00024 #include <gcrypt.h>
00025 }
00026
00027 #include "Logger.h"
00028
00029 class DdtMD
00030 {
00031 public:
00032 enum MDAlgos
00033 {
00034 MD_NONE = GCRY_MD_NONE,
00035 MD_MD5 = GCRY_MD_MD5,
00036 MD_SHA1 = GCRY_MD_SHA1,
00037 MD_RMD160 = GCRY_MD_RMD160,
00038 MD_TIGER = GCRY_MD_TIGER
00039 };
00040
00041 DdtMD(MDAlgos algo);
00042 ~DdtMD();
00043
00044 void write(unsigned char *buf, int length);
00045 int doFinal(unsigned char *buf, int length);
00046
00047 static int getAlgoDigestLength(MDAlgos algo);
00048 static int digest(MDAlgos algo, unsigned char* buf, int bufLength, unsigned char * digest, int digestLength);
00049
00050 private:
00051 gcry_md_hd_t mdHandle;
00052 MDAlgos algo;
00053 };
00054
00055
00056 #endif