mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
- Twine, StringRef, Format, and NativeFormatting have been removed - Logging now uses fmtlib style formatting - Nearly all uses of wpi::outs/errs have been replaced with fmt::print() or std::puts()/std::fputs() (for unformatted strings). - A wpi/fmt/raw_ostream.h header has been added to enable fmt::print() with wpi::raw_ostream
53 lines
1.0 KiB
C++
53 lines
1.0 KiB
C++
/*
|
|
sha1.hpp - header of
|
|
|
|
============
|
|
SHA-1 in C++
|
|
============
|
|
|
|
100% Public Domain.
|
|
|
|
Original C Code
|
|
-- Steve Reid <steve@edmweb.com>
|
|
Small changes to fit into bglibs
|
|
-- Bruce Guenter <bruce@untroubled.org>
|
|
Translation to simpler C++ Code
|
|
-- Volker Grabsch <vog@notjusthosting.com>
|
|
Safety fixes
|
|
-- Eugene Hopkinson <slowriot at voxelstorm dot com>
|
|
*/
|
|
|
|
#ifndef WPIUTIL_WPI_SHA1_H_
|
|
#define WPIUTIL_WPI_SHA1_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
namespace wpi {
|
|
template <typename T>
|
|
class SmallVectorImpl;
|
|
class raw_istream;
|
|
|
|
class SHA1 {
|
|
public:
|
|
SHA1();
|
|
void Update(std::string_view s);
|
|
void Update(raw_istream& is);
|
|
std::string Final();
|
|
std::string_view Final(SmallVectorImpl<char>& buf);
|
|
std::string_view RawFinal(SmallVectorImpl<char>& buf);
|
|
static std::string FromFile(std::string_view filename);
|
|
|
|
private:
|
|
uint32_t digest[5];
|
|
unsigned char buffer[64];
|
|
size_t buf_size;
|
|
uint64_t transforms;
|
|
};
|
|
|
|
} // namespace wpi
|
|
|
|
#endif // WPIUTIL_WPI_SHA1_H_
|