WPILibC++  2018.4.1-20180924003241-1198-g0c58a0a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
sha1.h
1 /*
2  sha1.hpp - header of
3 
4  ============
5  SHA-1 in C++
6  ============
7 
8  100% Public Domain.
9 
10  Original C Code
11  -- Steve Reid <steve@edmweb.com>
12  Small changes to fit into bglibs
13  -- Bruce Guenter <bruce@untroubled.org>
14  Translation to simpler C++ Code
15  -- Volker Grabsch <vog@notjusthosting.com>
16  Safety fixes
17  -- Eugene Hopkinson <slowriot at voxelstorm dot com>
18 */
19 
20 #ifndef WPIUTIL_WPI_SHA1_H_
21 #define WPIUTIL_WPI_SHA1_H_
22 
23 #include <stdint.h>
24 
25 #include <string>
26 
27 #include "wpi/StringRef.h"
28 
29 namespace wpi {
30 template <typename T>
31 class SmallVectorImpl;
32 class raw_istream;
33 
34 class SHA1 {
35  public:
36  SHA1();
37  void Update(StringRef s);
38  void Update(raw_istream& is);
39  std::string Final();
40  StringRef Final(SmallVectorImpl<char>& buf);
41  static std::string FromFile(StringRef filename);
42 
43  private:
44  uint32_t digest[5];
45  unsigned char buffer[64];
46  size_t buf_size;
47  uint64_t transforms;
48 };
49 
50 } // namespace wpi
51 
52 #endif // WPIUTIL_WPI_SHA1_H_
WPILib C++ utilities (wpiutil) namespace.
Definition: SmallString.h:21
Definition: raw_istream.h:26
Definition: sha1.h:34
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49