]> git.saurik.com Git - apt.git/blame - apt-pkg/contrib/sha1.h
add check when sources.list changed
[apt.git] / apt-pkg / contrib / sha1.h
CommitLineData
784202a2
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
233b185f 3// $Id: sha1.h,v 1.3 2001/05/07 05:05:47 jgg Exp $
784202a2
AL
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
784202a2 17#include <string>
4f333a8b 18#include <cstring>
42ab8223 19#include <algorithm>
784202a2 20
7ac56f8f 21#include "hashsum_template.h"
784202a2 22
a4f6bdc8
DK
23#ifndef APT_8_CLEANER_HEADERS
24using std::string;
25using std::min;
26#endif
27
7ac56f8f 28typedef HashSumValue<160> SHA1SumValue;
784202a2 29
c31c1dde 30class SHA1Summation : public SummationImplementation
784202a2 31{
70949daf
AL
32 /* assumes 64-bit alignment just in case */
33 unsigned char Buffer[64] __attribute__((aligned(8)));
34 unsigned char State[5*4] __attribute__((aligned(8)));
35 unsigned char Count[2*4] __attribute__((aligned(8)));
784202a2
AL
36 bool Done;
37
38 public:
650faab0 39 bool Add(const unsigned char *inbuf, unsigned long long inlen);
c31c1dde 40 using SummationImplementation::Add;
784202a2 41
784202a2
AL
42 SHA1SumValue Result();
43
44 SHA1Summation();
45};
46
47#endif