]> git.saurik.com Git - apt.git/blob - apt-pkg/contrib/sha1.h
do not pollute namespace in the headers with using (Closes: #500198)
[apt.git] / apt-pkg / contrib / sha1.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: sha1.h,v 1.3 2001/05/07 05:05:47 jgg Exp $
4 /* ######################################################################
5
6 SHA1SumValue - Storage for a SHA-1 hash.
7 SHA1Summation - SHA-1 Secure Hash Algorithm.
8
9 This is a C++ interface to a set of SHA1Sum functions, that mirrors
10 the equivalent MD5 classes.
11
12 ##################################################################### */
13 /*}}}*/
14 #ifndef APTPKG_SHA1_H
15 #define APTPKG_SHA1_H
16
17 #include <string>
18 #include <cstring>
19 #include <algorithm>
20
21 #include "hashsum_template.h"
22
23 typedef HashSumValue<160> SHA1SumValue;
24
25 class SHA1Summation : public SummationImplementation
26 {
27 /* assumes 64-bit alignment just in case */
28 unsigned char Buffer[64] __attribute__((aligned(8)));
29 unsigned char State[5*4] __attribute__((aligned(8)));
30 unsigned char Count[2*4] __attribute__((aligned(8)));
31 bool Done;
32
33 public:
34 bool Add(const unsigned char *inbuf, unsigned long long inlen);
35 using SummationImplementation::Add;
36
37 SHA1SumValue Result();
38
39 SHA1Summation();
40 };
41
42 #endif