diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-06-08 12:03:34 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-06-08 12:03:34 +0200 |
commit | 12cd178d6eb61306cc99e5e07c463c800d406771 (patch) | |
tree | 90941ebf0adb1c4b3ef9ca780a2b42cb1f2dfb16 /apt-pkg/contrib/sha256.h | |
parent | d953d210bb54accb416f2144104b79dcd29198ba (diff) | |
parent | 31693a8ff0fe593879ed30a4dde8f9be5b0859bf (diff) |
merge lp:~mvo/apt/sha512-template to add support for sha512
Diffstat (limited to 'apt-pkg/contrib/sha256.h')
-rw-r--r-- | apt-pkg/contrib/sha256.h | 68 |
1 files changed, 2 insertions, 66 deletions
diff --git a/apt-pkg/contrib/sha256.h b/apt-pkg/contrib/sha256.h index 5934b5641..fe2b30ac2 100644 --- a/apt-pkg/contrib/sha256.h +++ b/apt-pkg/contrib/sha256.h @@ -1,72 +1,8 @@ -// -*- mode: cpp; mode: fold -*- -// Description /*{{{*/ -// $Id: sha1.h,v 1.3 2001/05/07 05:05:47 jgg Exp $ -/* ###################################################################### - - SHA256SumValue - Storage for a SHA-256 hash. - SHA256Summation - SHA-256 Secure Hash Algorithm. - - This is a C++ interface to a set of SHA256Sum functions, that mirrors - the equivalent MD5 & SHA1 classes. - - ##################################################################### */ - /*}}}*/ #ifndef APTPKG_SHA256_H #define APTPKG_SHA256_H -#include <string> -#include <cstring> -#include <algorithm> -#include <stdint.h> - -using std::string; -using std::min; - -class SHA256Summation; - -class SHA256SumValue -{ - friend class SHA256Summation; - unsigned char Sum[32]; - - public: - - // Accessors - bool operator ==(const SHA256SumValue &rhs) const; - string Value() const; - inline void Value(unsigned char S[32]) - {for (int I = 0; I != sizeof(Sum); I++) S[I] = Sum[I];}; - inline operator string() const {return Value();}; - bool Set(string Str); - inline void Set(unsigned char S[32]) - {for (int I = 0; I != sizeof(Sum); I++) Sum[I] = S[I];}; - - SHA256SumValue(string Str); - SHA256SumValue(); -}; - -struct sha256_ctx { - uint32_t count[2]; - uint32_t state[8]; - uint8_t buf[128]; -}; - -class SHA256Summation -{ - struct sha256_ctx Sum; - - bool Done; - - public: +#include "sha2.h" - bool Add(const unsigned char *inbuf,unsigned long inlen); - inline bool Add(const char *Data) {return Add((unsigned char *)Data,strlen(Data));}; - bool AddFD(int Fd,unsigned long Size); - inline bool Add(const unsigned char *Beg,const unsigned char *End) - {return Add(Beg,End-Beg);}; - SHA256SumValue Result(); - - SHA256Summation(); -}; +#warn "This header is deprecated, please include sha2.h instead" #endif |