I am trying to authenticate to OBS software (websockets) using ESP32
I can communicate send and receive data from ESP32 but can't authenticate. The process is as following:
send auth request and get challenge and salt
then process the data and send auth_response back
Pseudo Code Example:
password = "supersecretpassword"
challenge = "ztTBnnuqrqaKDzRM3xcVdbYm"
salt = "PZVbYpvAnZut2SS6JNJytDm9"
secret_string = password + salt
secret_hash = binary_sha256(secret_string)
secret = base64_encode(secret_hash)
auth_response_string = secret + challenge
auth_response_hash = binary_sha256(auth_response_string)
auth_response = base64_encode(auth_response_hash)
It works using different clients like JS example
In my ESP32 I can get first two steps working:
secret_string = password + salt
secret_hash = binary_sha256(secret_string)
but when I try:
secret = base64_encode(secret_hash)
I get a different result comparing to JS the example
Arduino references
#include "mbedtls/md.h"
#include <base64.h>
code:
String encoded = base64::encode("blablabla");
Serial.println("encoded: ");
Serial.println(encoded);
Wondering why I get different results in Arduino core and JavaScript while using base64::encode