WPILibC++  2019.2.1-17-g6992f54
 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  StringRef RawFinal(SmallVectorImpl<char>& buf);
42  static std::string FromFile(StringRef filename);
43 
44  private:
45  uint32_t digest[5];
46  unsigned char buffer[64];
47  size_t buf_size;
48  uint64_t transforms;
49 };
50 
51 } // namespace wpi
52 
53 #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