~l3on/ubuntu/lucid/apt/fix-917845

« back to all changes in this revision

Viewing changes to apt-pkg/contrib/md5.h

  • Committer: Bazaar Package Importer
  • Author(s): Jason Gunthorpe
  • Date: 2001-08-18 17:21:59 UTC
  • Revision ID: james.westby@ubuntu.com-20010818172159-85f7g43wdzi9dwb5
Tags: 0.5.4
* M68k config.guess patch. Closes: #88913
* Bi-yearly test on OpenBSD and Solaris
* Doc updates. Closes: #89121, #89854, #99671, #98353, #95823, #93057,
        #97520, #102867, #101071, #102421, #101565, #98272, #106914,
        #105606, #105377
* Various cosmetic code updates. Closes: #89066, #89066, #89152
* Add "pre-auto" as an option for DSelect::Clean (run autoclean after
  update).
* More patches from Alfredo for Vendors and more SHA-1 stuff
* Fix for AJ's 'desire to remove perl-5.005' and possibly other
  similar situations. Closes: #56708, #59432
* no_proxy and ftp. Closes: #89671
* Philippe Batailler's man page patches.
* Fix for display bug. Closes: #92033, #93652, #98468
* Use more than 16bits for the dep ID. Some people ran out..
  Closes: #103020, #97809, #102951, #99974, #107362, #107395, #107362,
          #106911, #107395, #108968
* Reordered some things to make dante and FTP happier. Closes: #92757
* James R. Van Zandt's guide.sgml updates. Closes: #90027
* apt-ftparchive copes with no uncompressed package files + contents.
* French man pages from philippe batailler - well sort of. They 
  don't build yet..
* run-parts. Closes: #94286
* 'apt-cache policy' preferences debug tool.
* Whatever. Closes: #89762
* libstdc++ and HURD. Closes: #92025
* More apt-utils verbage. Closes: #86954
* Fliped comparision operator. Closes: #94618
* Used the right copyright file. Closes: #65691
* Randolph's G++3 patches. 
* Fixed no_proxy tokanizing. Closes: #100046
* Strip Config-Version when copying status to available. Closes: #97520
* Segfault with missing source files. Closes: #100325
* EINTR check. Closes: #102293
* Various changes to the locking metholodgy for --print-uris. 
  Closes: #100590
* Lame LD_LIBRARY_PATH thing. Closes: #98928
* apt-cache search searchs provide names too now. Closes: #98695
* Checksum and long lines problem. Closes: #106591
* .aptignr and empty files are just a warning. Closes: #97364  

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- mode: cpp; mode: fold -*-
 
2
// Description                                                          /*{{{*/
 
3
// $Id: md5.h,v 1.6 2001/05/07 05:06:52 jgg Exp $
 
4
/* ######################################################################
 
5
   
 
6
   MD5SumValue - Storage for a MD5Sum
 
7
   MD5Summation - MD5 Message Digest Algorithm.
 
8
   
 
9
   This is a C++ interface to a set of MD5Sum functions. The class can
 
10
   store a MD5Sum in 16 bytes of memory.
 
11
   
 
12
   A MD5Sum is used to generate a (hopefully) unique 16 byte number for a
 
13
   block of data. This can be used to gaurd against corruption of a file.
 
14
   MD5 should not be used for tamper protection, use SHA or something more
 
15
   secure.
 
16
   
 
17
   There are two classes because computing a MD5 is not a continual 
 
18
   operation unless 64 byte blocks are used. Also the summation requires an
 
19
   extra 18*4 bytes to operate.
 
20
   
 
21
   ##################################################################### */
 
22
                                                                        /*}}}*/
 
23
#ifndef APTPKG_MD5_H
 
24
#define APTPKG_MD5_H
 
25
 
 
26
#ifdef __GNUG__
 
27
#pragma interface "apt-pkg/md5.h"
 
28
#endif 
 
29
 
 
30
#include <string>
 
31
 
 
32
using std::string;
 
33
 
 
34
class MD5Summation;
 
35
 
 
36
class MD5SumValue
 
37
{
 
38
   friend class MD5Summation;
 
39
   unsigned char Sum[4*4];
 
40
   
 
41
   public:
 
42
 
 
43
   // Accessors
 
44
   bool operator ==(const MD5SumValue &rhs) const; 
 
45
   string Value() const;
 
46
   inline void Value(unsigned char S[16]) 
 
47
         {for (int I = 0; I != sizeof(Sum); I++) S[I] = Sum[I];};
 
48
   inline operator string() const {return Value();};
 
49
   bool Set(string Str);
 
50
   inline void Set(unsigned char S[16]) 
 
51
         {for (int I = 0; I != sizeof(Sum); I++) Sum[I] = S[I];};
 
52
 
 
53
   MD5SumValue(string Str);
 
54
   MD5SumValue();
 
55
};
 
56
 
 
57
class MD5Summation
 
58
{
 
59
   unsigned char Buf[4*4];
 
60
   unsigned char Bytes[2*4];
 
61
   unsigned char In[16*4];
 
62
   bool Done;
 
63
   
 
64
   public:
 
65
 
 
66
   bool Add(const unsigned char *Data,unsigned long Size);
 
67
   inline bool Add(const char *Data) {return Add((unsigned char *)Data,strlen(Data));};
 
68
   bool AddFD(int Fd,unsigned long Size);
 
69
   inline bool Add(const unsigned char *Beg,const unsigned char *End) 
 
70
                  {return Add(Beg,End-Beg);};
 
71
   MD5SumValue Result();
 
72
   
 
73
   MD5Summation();
 
74
};
 
75
 
 
76
#endif