md5.hh

Go to the documentation of this file.
00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 2006, 2007 Ciaran McCreesh
00005  *
00006  * This file is part of the Paludis package manager. Paludis is free software;
00007  * you can redistribute it and/or modify it under the terms of the GNU General
00008  * Public License version 2, as published by the Free Software Foundation.
00009  *
00010  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
00011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00012  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00013  * details.
00014  *
00015  * You should have received a copy of the GNU General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #ifndef PALUDIS_GUARD_PALUDIS_UTIL_MD5_HH
00021 #define PALUDIS_GUARD_PALUDIS_UTIL_MD5_HH 1
00022 
00023 #include <iosfwd>
00024 #include <string>
00025 #include <inttypes.h>
00026 #include <paludis/util/attributes.hh>
00027 
00028 /** \file
00029  * Declarations for the MD5 digest class.
00030  *
00031  * \ingroup g_digests
00032  *
00033  * \section Examples
00034  *
00035  * - None at this time.
00036  */
00037 
00038 namespace paludis
00039 {
00040     /**
00041      * MD5 digest class.
00042      *
00043      * \ingroup g_digests
00044      */
00045     class PALUDIS_VISIBLE MD5
00046     {
00047         private:
00048             static const PALUDIS_HIDDEN uint32_t _t[64];
00049             static const PALUDIS_HIDDEN uint8_t _s[64];
00050             uint32_t _r[4];
00051             uint64_t _size;
00052             bool _done_one_pad;
00053 
00054             void PALUDIS_HIDDEN _update(const uint8_t * const block);
00055 
00056             inline int PALUDIS_HIDDEN _get(std::istream & stream);
00057 
00058         public:
00059             /**
00060              * Constructor.
00061              */
00062             MD5(std::istream & stream);
00063 
00064             /**
00065              * Our checksum, as a string of hex characters.
00066              */
00067             std::string hexsum() const;
00068     };
00069 }
00070 
00071 #endif

Generated on Mon Sep 21 10:36:08 2009 for paludis by  doxygen 1.5.4