]>
git.saurik.com Git - apt.git/blob - apt-pkg/contrib/sha2.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: sha512.h,v 1.3 2001/05/07 05:05:47 jgg Exp $
4 /* ######################################################################
6 SHA{512,256}SumValue - Storage for a SHA-{512,256} hash.
7 SHA{512,256}Summation - SHA-{512,256} Secure Hash Algorithm.
9 This is a C++ interface to a set of SHA{512,256}Sum functions, that mirrors
10 the equivalent MD5 & SHA1 classes.
12 ##################################################################### */
22 #include "sha2_internal.h"
23 #include "hashsum_template.h"
28 class SHA512Summation
;
29 class SHA256Summation
;
31 typedef HashSumValue
<512> SHA512SumValue
;
32 typedef HashSumValue
<256> SHA256SumValue
;
37 unsigned char Sum
[32];
42 bool Add(const unsigned char *inbuf
,unsigned long inlen
);
43 inline bool Add(const char *Data
) {return Add((unsigned char *)Data
,strlen(Data
));};
44 bool AddFD(int Fd
,unsigned long Size
);
45 inline bool Add(const unsigned char *Beg
,const unsigned char *End
)
46 {return Add(Beg
,End
-Beg
);};
47 SHA256SumValue
Result();
55 unsigned char Sum
[64];
60 bool Add(const unsigned char *inbuf
,unsigned long inlen
);
61 inline bool Add(const char *Data
) {return Add((unsigned char *)Data
,strlen(Data
));};
62 bool AddFD(int Fd
,unsigned long Size
);
63 inline bool Add(const unsigned char *Beg
,const unsigned char *End
)
64 {return Add(Beg
,End
-Beg
);};
65 SHA512SumValue
Result();