]> git.saurik.com Git - apt.git/blame_incremental - apt-pkg/contrib/sha1.h
testcases runable as root
[apt.git] / apt-pkg / contrib / sha1.h
... / ...
CommitLineData
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 "hashsum_template.h"
18
19#ifndef APT_10_CLEANER_HEADERS
20#include <string>
21#include <cstring>
22#include <algorithm>
23#endif
24#ifndef APT_8_CLEANER_HEADERS
25using std::string;
26using std::min;
27#endif
28
29typedef HashSumValue<160> SHA1SumValue;
30
31class SHA1Summation : public SummationImplementation
32{
33 /* assumes 64-bit alignment just in case */
34 unsigned char Buffer[64] __attribute__((aligned(8)));
35 unsigned char State[5*4] __attribute__((aligned(8)));
36 unsigned char Count[2*4] __attribute__((aligned(8)));
37 bool Done;
38
39 public:
40 bool Add(const unsigned char *inbuf, unsigned long long inlen);
41 using SummationImplementation::Add;
42
43 SHA1SumValue Result();
44
45 SHA1Summation();
46};
47
48#endif