Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1a504a6

Browse filesBrowse files
Staarsme-no-dev
andauthored
WebServer: use MD5Builder instead of mbed (#8667)
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
1 parent 826a426 commit 1a504a6
Copy full SHA for 1a504a6

File tree

Expand file treeCollapse file tree

1 file changed

+6
-18
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-18
lines changed

‎libraries/WebServer/src/WebServer.cpp

Copy file name to clipboardExpand all lines: libraries/WebServer/src/WebServer.cpp
+6-18Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "WebServer.h"
3131
#include "FS.h"
3232
#include "detail/RequestHandlersImpl.h"
33-
#include "mbedtls/md5.h"
33+
#include "MD5Builder.h"
3434

3535

3636
static const char AUTHORIZATION_HEADER[] = "Authorization";
@@ -120,23 +120,11 @@ String WebServer::_extractParam(String& authReq,const String& param,const char d
120120
}
121121

122122
static String md5str(String &in){
123-
char out[33] = {0};
124-
mbedtls_md5_context _ctx;
125-
uint8_t i;
126-
uint8_t * _buf = (uint8_t*)malloc(16);
127-
if(_buf == NULL)
128-
return String(out);
129-
memset(_buf, 0x00, 16);
130-
mbedtls_md5_init(&_ctx);
131-
mbedtls_md5_starts(&_ctx);
132-
mbedtls_md5_update(&_ctx, (const uint8_t *)in.c_str(), in.length());
133-
mbedtls_md5_finish(&_ctx, _buf);
134-
for(i = 0; i < 16; i++) {
135-
sprintf(out + (i * 2), "%02x", _buf[i]);
136-
}
137-
out[32] = 0;
138-
free(_buf);
139-
return String(out);
123+
MD5Builder md5 = MD5Builder();
124+
md5.begin();
125+
md5.add(in);
126+
md5.calculate();
127+
return md5.toString();
140128
}
141129

142130
bool WebServer::authenticate(const char * username, const char * password){

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.