Main Page   Reference Manual   Compound List   File List  

libecc/sha.h

Go to the documentation of this file.
00001 //
00006 //
00007 // This file is part of the libecc package.
00008 // Copyright (C) 2002, by
00009 //
00010 // Carlo Wood, Run on IRC <carlo@alinoe.com>
00011 // RSA-1024 0x624ACAD5 1997-01-26                    Sign & Encrypt
00012 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6  F6 F6 55 DD 1C DC FF 61
00013 //
00014 // This program is free software; you can redistribute it and/or
00015 // modify it under the terms of the GNU General Public License
00016 // as published by the Free Software Foundation; either version 2
00017 // of the License, or (at your option) any later version.
00018 //
00019 // This program is distributed in the hope that it will be useful,
00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 // GNU General Public License for more details.
00023 //
00024 // You should have received a copy of the GNU General Public License
00025 // along with this program; if not, write to the Free Software
00026 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00027 //
00028 
00029 #ifndef LIBECC_SHA_H
00030 #define LIBECC_SHA_H
00031 
00032 #include <libecc/bitset.h>
00033 
00034 namespacelibecc {
00035 
00056 classsha1 {
00057   private:
00058     uint32_t H0;
00059     uint32_t H1;
00060     uint32_t H2;
00061     uint32_t H3;
00062     uint32_t H4;
00063     uint32_t A;
00064     uint32_t B;
00065     uint32_t C;
00066     uint32_t D;
00067     uint32_t E;
00068     uint32_t W[80];
00069 
00070   public:
00074     sha1(void);
00075 
00113     void process_msg(bitset_digit_t const* message, size_t number_of_bits);
00114 
00122     template<unsigned int n> void process_msg(bitset<n> const& message, size_t number_of_bits = n)
00123         { process_msg(message.digits_ptr(), number_of_bits); }
00124 
00130     bitset<160> digest(void) const;
00131 
00132   protected:
00139     void reset();
00140 
00148     void process_block(bitset_digit_t const* block);
00149 };
00150 
00151 } // namespace libecc
00152 
00153 #endif // LIBECC_SHA_H
Copyright © 2002-2008 Carlo Wood.  All rights reserved.