]>
git.saurik.com Git - apt.git/blob - apt-pkg/contrib/sha1.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: sha1.h,v 1.1 2001/03/06 05:03:49 jgg Exp $
4 /* ######################################################################
6 SHA1SumValue - Storage for a SHA-1 hash.
7 SHA1Summation - SHA-1 Secure Hash Algorithm.
9 This is a C++ interface to a set of SHA1Sum functions, that mirrors
10 the equivalent MD5 classes.
12 ##################################################################### */
18 #pragma interface "apt-pkg/sha1.h"
27 friend class SHA1Summation
;
28 unsigned char Sum
[20];
33 bool operator ==(const SHA1SumValue
&rhs
) const;
35 inline void Value(unsigned char S
[20])
36 {for (int I
= 0; I
!= sizeof(Sum
); I
++) S
[I
] = Sum
[I
];};
37 inline operator string() const {return Value();};
39 inline void Set(unsigned char S
[20])
40 {for (int I
= 0; I
!= sizeof(Sum
); I
++) Sum
[I
] = S
[I
];};
42 SHA1SumValue(string Str
);
48 unsigned char Buffer
[64];
49 unsigned char State
[5*4];
50 unsigned char Count
[2*4];
55 bool Add(const unsigned char *inbuf
,unsigned long inlen
);
56 inline bool Add(const char *Data
) {return Add((unsigned char *)Data
,strlen(Data
));};
57 bool AddFD(int Fd
,unsigned long Size
);
58 inline bool Add(const unsigned char *Beg
,const unsigned char *End
)
59 {return Add(Beg
,End
-Beg
);};
60 SHA1SumValue
Result();