WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
sha1.hpp
Go to the documentation of this file.
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#pragma once
21
22#include <stdint.h>
23
24#include <string>
25#include <string_view>
26
27namespace wpi::util {
28template <typename T>
29class SmallVectorImpl;
30class raw_istream;
31
32class SHA1 {
33 public:
35 void Update(std::string_view s);
37 std::string Final();
38 std::string_view Final(SmallVectorImpl<char>& buf);
39 std::string_view RawFinal(SmallVectorImpl<char>& buf);
40 static std::string FromFile(std::string_view filename);
41
42 private:
43 uint32_t digest[5];
44 unsigned char buffer[64];
45 size_t buf_size;
46 uint64_t transforms;
47};
48
49} // namespace wpi::util
static std::string FromFile(std::string_view filename)
std::string_view RawFinal(SmallVectorImpl< char > &buf)
void Update(std::string_view s)
std::string Final()
std::string_view Final(SmallVectorImpl< char > &buf)
void Update(raw_istream &is)
Definition BooleanTopic.hpp:24
Definition raw_istream.hpp:21
Definition raw_os_ostream.hpp:19