apt
@VERSION@
|
00001 // -*- mode: cpp; mode: fold -*- 00002 // Description /*{{{*/ 00003 // $Id: sha1.h,v 1.3 2001/05/07 05:05:47 jgg Exp $ 00004 /* ###################################################################### 00005 00006 SHA1SumValue - Storage for a SHA-1 hash. 00007 SHA1Summation - SHA-1 Secure Hash Algorithm. 00008 00009 This is a C++ interface to a set of SHA1Sum functions, that mirrors 00010 the equivalent MD5 classes. 00011 00012 ##################################################################### */ 00013 /*}}}*/ 00014 #ifndef APTPKG_SHA1_H 00015 #define APTPKG_SHA1_H 00016 00017 #include <string> 00018 #include <cstring> 00019 #include <algorithm> 00020 00021 #include "hashsum_template.h" 00022 00023 #ifndef APT_8_CLEANER_HEADERS 00024 using std::string; 00025 using std::min; 00026 #endif 00027 00028 typedef HashSumValue<160> SHA1SumValue; 00029 00030 class SHA1Summation : public SummationImplementation 00031 { 00032 /* assumes 64-bit alignment just in case */ 00033 unsigned char Buffer[64] __attribute__((aligned(8))); 00034 unsigned char State[5*4] __attribute__((aligned(8))); 00035 unsigned char Count[2*4] __attribute__((aligned(8))); 00036 bool Done; 00037 00038 public: 00039 bool Add(const unsigned char *inbuf, unsigned long long inlen); 00040 using SummationImplementation::Add; 00041 00042 SHA1SumValue Result(); 00043 00044 SHA1Summation(); 00045 }; 00046 00047 #endif