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::MD5Context Class Reference

Public Member Functions

void Add (const_data_ptr_t data, idx_t len)
 
void Add (const char *data)
 
void Add (string_t string)
 
void Add (const string &data)
 
void Finish (data_ptr_t out_digest)
 Write the 16-byte (binary) digest to the specified location.
 
void FinishHex (char *out_digest)
 Write the 32-character digest (in hexadecimal format) to the specified location.
 
string FinishHex ()
 Returns the 32-character digest (in hexadecimal format) as a string.
 

Static Public Attributes

static constexpr idx_t MD5_HASH_LENGTH_BINARY = 16
 
static constexpr idx_t MD5_HASH_LENGTH_TEXT = 32
 

Private Member Functions

void MD5Update (const_data_ptr_t data, idx_t len)
 

Private Attributes

uint32_t buf [4]
 
uint32_t bits [2]
 
unsigned char in [64]
 

Constructor & Destructor Documentation

◆ MD5Context()

duckdb::MD5Context::MD5Context ( )
50691 {
50692 buf[0] = 0x67452301;
50693 buf[1] = 0xefcdab89;
50694 buf[2] = 0x98badcfe;
50695 buf[3] = 0x10325476;
50696 bits[0] = 0;
50697 bits[1] = 0;
50698}

Member Function Documentation

◆ Add() [1/4]

void duckdb::MD5Context::Add ( const_data_ptr_t  data,
idx_t  len 
)
inline
50401 {
50402 MD5Update(data, len);
50403 }

◆ Add() [2/4]

void duckdb::MD5Context::Add ( const char data)
50804 {
50805 MD5Update(const_data_ptr_cast(data), strlen(data));
50806}

◆ Add() [3/4]

void duckdb::MD5Context::Add ( string_t  string)
inline
50405 {
50406 MD5Update(const_data_ptr_cast(string.GetData()), string.GetSize());
50407 }

◆ Add() [4/4]

void duckdb::MD5Context::Add ( const string &  data)
inline
50408 {
50409 MD5Update(const_data_ptr_cast(data.c_str()), data.size());
50410 }

◆ Finish()

void duckdb::MD5Context::Finish ( data_ptr_t  out_digest)

Write the 16-byte (binary) digest to the specified location.

50753 {
50754 unsigned count;
50755 unsigned char *p;
50756
50757 /* Compute number of bytes mod 64 */
50758 count = (bits[0] >> 3) & 0x3F;
50759
50760 /* Set the first char of padding to 0x80. This is safe since there is
50761 always at least one byte free */
50762 p = in + count;
50763 *p++ = 0x80;
50764
50765 /* Bytes of padding needed to make 64 bytes */
50766 count = 64 - 1 - count;
50767
50768 /* Pad out to 56 mod 64 */
50769 if (count < 8) {
50770 /* Two lots of padding: Pad the first block to 64 bytes */
50771 memset(p, 0, count);
50772 ByteReverse(in, 16);
50773 MD5Transform(buf, reinterpret_cast<uint32_t *>(in));
50774
50775 /* Now fill the next block with 56 bytes */
50776 memset(in, 0, 56);
50777 } else {
50778 /* Pad block to 56 bytes */
50779 memset(p, 0, count - 8);
50780 }
50781 ByteReverse(in, 14);
50782
50783 /* Append length in bits and transform */
50784 (reinterpret_cast<uint32_t *>(in))[14] = bits[0];
50785 (reinterpret_cast<uint32_t *>(in))[15] = bits[1];
50786
50787 MD5Transform(buf, reinterpret_cast<uint32_t *>(in));
50788 ByteReverse(reinterpret_cast<unsigned char *>(buf), 4);
50789 memcpy(out_digest, buf, 16);
50790}
::uint32_t uint32_t
Here is the caller graph for this function:

◆ FinishHex() [1/2]

void duckdb::MD5Context::FinishHex ( char out_digest)

Write the 32-character digest (in hexadecimal format) to the specified location.

50792 {
50793 data_t digest[MD5_HASH_LENGTH_BINARY];
50794 Finish(digest);
50795 duckdb_mbedtls::MbedTlsWrapper::ToBase16(reinterpret_cast<char *>(digest), out_digest, MD5_HASH_LENGTH_BINARY);
50796}
void Finish(data_ptr_t out_digest)
Write the 16-byte (binary) digest to the specified location.
Definition duckdb.cpp:50753
uint8_t data_t
data pointers
Definition duckdb.hpp:246
Here is the call graph for this function:

◆ FinishHex() [2/2]

string duckdb::MD5Context::FinishHex ( )

Returns the 32-character digest (in hexadecimal format) as a string.

50798 {
50799 char digest[MD5_HASH_LENGTH_TEXT];
50800 FinishHex(digest);
50801 return string(digest, MD5_HASH_LENGTH_TEXT);
50802}
string FinishHex()
Returns the 32-character digest (in hexadecimal format) as a string.
Definition duckdb.cpp:50798
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MD5Update()

void duckdb::MD5Context::MD5Update ( const_data_ptr_t  data,
idx_t  len 
)
private
50704 {
50705 uint32_t t;
50706
50707 /* Update bitcount */
50708
50709 t = bits[0];
50710 bits[0] = t + ((uint32_t)len << 3);
50711 if (bits[0] < t) {
50712 bits[1]++; /* Carry from low to high */
50713 }
50714 bits[1] += len >> 29;
50715
50716 t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
50717
50718 /* Handle any leading odd-sized chunks */
50719
50720 if (t) {
50721 unsigned char *p = (unsigned char *)in + t;
50722
50723 t = 64 - t;
50724 if (len < t) {
50725 memcpy(p, input, len);
50726 return;
50727 }
50728 memcpy(p, input, t);
50729 ByteReverse(in, 16);
50730 MD5Transform(buf, reinterpret_cast<uint32_t *>(in));
50731 input += t;
50732 len -= t;
50733 }
50734
50735 /* Process data in 64-byte chunks */
50736
50737 while (len >= 64) {
50738 memcpy(in, input, 64);
50739 ByteReverse(in, 16);
50740 MD5Transform(buf, reinterpret_cast<uint32_t *>(in));
50741 input += 64;
50742 len -= 64;
50743 }
50744
50745 /* Handle any remaining bytes of data. */
50746 memcpy(in, input, len);
50747}

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