Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb_mbedtls::MbedTlsWrapper::SHA1State Class Reference

Public Member Functions

void AddString (const std::string &str)
std::string Finalize ()
void FinishHex (char *out)

Private Attributes

void * sha_context

Constructor & Destructor Documentation

◆ SHA1State()

MbedTlsWrapper::SHA1State::SHA1State ( )
597721 : sha_context(new mbedtls_sha1_context()) {
597722 auto context = reinterpret_cast<mbedtls_sha1_context *>(sha_context);
597723
597724 mbedtls_sha1_init(context);
597725
597726 if (mbedtls_sha1_starts(context)) {
597727 throw std::runtime_error("SHA1 Error");
597728 }
struct mbedtls_sha1_context mbedtls_sha1_context
The SHA-1 context structure.
int mbedtls_sha1_starts(mbedtls_sha1_context *ctx)
This function starts a SHA-1 checksum calculation.
Definition duckdb.cpp:596103
void mbedtls_sha1_init(mbedtls_sha1_context *ctx)
This function initializes a SHA-1 context.
Definition duckdb.cpp:596080

◆ ~SHA1State()

MbedTlsWrapper::SHA1State::~SHA1State ( )
597731 {
597732 auto context = reinterpret_cast<mbedtls_sha1_context *>(sha_context);
597733 mbedtls_sha1_free(context);
597734 delete context;
void mbedtls_sha1_free(mbedtls_sha1_context *ctx)
This function clears a SHA-1 context.
Definition duckdb.cpp:596085

Member Function Documentation

◆ AddString()

void MbedTlsWrapper::SHA1State::AddString ( const std::string & str)
597737 {
597738 auto context = reinterpret_cast<mbedtls_sha1_context *>(sha_context);
597739 if (mbedtls_sha1_update(context, (unsigned char *)str.data(), str.size())) {
597740 throw std::runtime_error("SHA1 Error");
597741 }
int mbedtls_sha1_update(mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen)
This function feeds an input buffer into an ongoing SHA-1 checksum calculation.
Definition duckdb.cpp:596291

◆ Finalize()

std::string MbedTlsWrapper::SHA1State::Finalize ( )
597744 {
597745 auto context = reinterpret_cast<mbedtls_sha1_context *>(sha_context);
597746
597747 string hash;
597748 hash.resize(MbedTlsWrapper::SHA1_HASH_LENGTH_BYTES);
597749
597750 if (mbedtls_sha1_finish(context, (unsigned char *)hash.data())) {
597751 throw std::runtime_error("SHA1 Error");
597752 }
597753
597754 return hash;
int mbedtls_sha1_finish(mbedtls_sha1_context *ctx, unsigned char output[20])
This function finishes the SHA-1 operation, and writes the result to the output buffer.
Definition duckdb.cpp:596344

◆ FinishHex()

void MbedTlsWrapper::SHA1State::FinishHex ( char * out)
597757 {
597758 auto context = reinterpret_cast<mbedtls_sha1_context *>(sha_context);
597759
597760 string hash;
597761 hash.resize(MbedTlsWrapper::SHA1_HASH_LENGTH_BYTES);
597762
597763 if (mbedtls_sha1_finish(context, (unsigned char *)hash.data())) {
597764 throw std::runtime_error("SHA1 Error");
597765 }
597766
597767 MbedTlsWrapper::ToBase16(const_cast<char *>(hash.c_str()), out, MbedTlsWrapper::SHA1_HASH_LENGTH_BYTES);

The documentation for this class was generated from the following file: