rmd160.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_RMD160_HH
00021 #define PALUDIS_GUARD_PALUDIS_UTIL_RMD160_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 RMD160 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      * RMD160 digest class.
00042      *
00043      * \ingroup g_digests
00044      */
00045     class PALUDIS_VISIBLE RMD160
00046     {
00047         private:
00048             static const PALUDIS_HIDDEN uint8_t _r[80], _rp[80];
00049             static const PALUDIS_HIDDEN uint8_t _s[80], _sp[80];
00050             static const PALUDIS_HIDDEN uint32_t _k[5], _kp[5];
00051 
00052             uint32_t _h[5];
00053             uint64_t _size;
00054             bool _done_one_pad;
00055 
00056             void PALUDIS_HIDDEN _update(const uint8_t * const block);
00057 
00058             inline int PALUDIS_HIDDEN _get(std::istream & stream);
00059 
00060         public:
00061             /**
00062              * Constructor.
00063              */
00064             RMD160(std::istream & stream);
00065 
00066             /**
00067              * Our checksum, as a string of hex characters.
00068              */
00069             std::string hexsum() const;
00070     };
00071 
00072 }
00073 
00074 #endif
00075 

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