Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

DdtMD.h

00001 /* hey emacs! -*- Mode: C++; c-file-style: "stroustrup"; indent-tabs-mode: nil -*- */
00002 /*
00003  * $Id: DdtMD.h,v 1.1 2001/11/24 21:26:16 benoit Exp $
00004  *
00005  * Copyright (c) 2001 Benoit Joly <benoit@dhis.net>
00006  *
00007  * DDT comes with ABSOLUTELY NO WARRANTY and is licenced under the
00008  * GNU General Public License (version 2 or later). This license
00009  * can be retrieved from http://www.gnu.org/copyleft/gnu.html.
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

Generated on Tue Sep 13 01:32:46 2005 for DDT Project by  doxygen 1.4.4