Closed bryal closed 1 year ago
That's not a good solution because it always allocates memory, and that's not necessary. Can you go without? e.g. by using std::string_view
?
Good suggestion! I will apply this presently.
Is this better? There is no overload of +
for string_view, so I had to construct the intermediary std::string
explicitly, which was previously created transiently by the password_md5 + timestamp
expression. At least there's only a single allocation again now.
Yes, better. And I wish we could eliminate that allocation by doing incremental MD5. I'll check that.
buffer
is not null terminated, but is implicitly interpreted as a C-string in the call tomd5_hex
. The fix is to convert it to a std::string beforehand, with its length (MD5_HEX_SIZE) given explicitly.Fixes #47