add const specifier to make md5 more general

This commit is contained in:
Krasimir Angelov
2023-12-05 15:02:49 +01:00
parent da135bea8b
commit 85f3aa3eca
2 changed files with 4 additions and 4 deletions

View File

@@ -129,7 +129,7 @@ void md5Step(uint32_t *buffer, uint32_t *input){
* If the input fills out a block of 512 bits, apply the algorithm (md5Step)
* and save the result in the buffer. Also updates the overall size.
*/
void MD5Context::update(uint8_t *input_buffer, size_t input_len)
void MD5Context::update(const uint8_t *input_buffer, size_t input_len)
{
uint32_t input[16];
unsigned int offset = this->size % 64;

View File

@@ -16,12 +16,12 @@ class PGF_INTERNAL_DECL MD5Context {
public:
MD5Context();
void update(uint8_t *input, size_t input_len);
void update(const uint8_t *input, size_t input_len);
template <class T>
void update(T &input)
void update(const T &input)
{
update((uint8_t *) &input, sizeof(T));
update((const uint8_t *) &input, sizeof(T));
}
void finalize(MD5Digest *digest);