Skip to content

Commit

Permalink
add const specifier to make md5 more general
Browse files Browse the repository at this point in the history
  • Loading branch information
krangelov committed Dec 5, 2023
1 parent da135be commit 85f3aa3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/runtime/c/pgf/md5.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/c/pgf/md5.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 85f3aa3

Please sign in to comment.