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