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 using std::string; 00022 using std::min; 00023 00024 #include "hashsum_template.h" 00025 00026 typedef HashSumValue<160> SHA1SumValue; 00027 00028 class SHA1Summation : public SummationImplementation 00029 { 00030 /* assumes 64-bit alignment just in case */ 00031 unsigned char Buffer[64] __attribute__((aligned(8))); 00032 unsigned char State[5*4] __attribute__((aligned(8))); 00033 unsigned char Count[2*4] __attribute__((aligned(8))); 00034 bool Done; 00035 00036 public: 00037 bool Add(const unsigned char *inbuf, unsigned long inlen); 00038 using SummationImplementation::Add; 00039 00040 SHA1SumValue Result(); 00041 00042 SHA1Summation(); 00043 }; 00044 00045 #endif