diff --git a/src/WebAuthentication.cpp b/src/WebAuthentication.cpp index cb261b2..ab15e4a 100644 --- a/src/WebAuthentication.cpp +++ b/src/WebAuthentication.cpp @@ -28,7 +28,7 @@ bool checkBasicAuthentication(const char * hash, const char * username, const ch if(username == NULL || password == NULL || hash == NULL) return false; - size_t toencodeLen = os_strlen(username)+os_strlen(password)+1; + size_t toencodeLen = strlen(username)+strlen(password)+1; size_t encodedLen = base64_encode_expected_len(toencodeLen); if(strlen(hash) != encodedLen) return false; @@ -71,7 +71,11 @@ static bool getMD5(uint8_t * data, uint16_t len, char * output){//33 bytes or mo } static String genRandomMD5(){ +#ifdef ESP8266 uint32_t r = RANDOM_REG32; +#else + uint32_t r = rand(); +#endif char * out = (char*)malloc(33); if(out == NULL || !getMD5((uint8_t*)(&r), 4, out)) return "";