mirror of
https://github.com/Links2004/arduinoWebSockets.git
synced 2025-07-16 08:42:06 +02:00
Update WebSockets.cpp
added esp32 hwcrypto for sha1
This commit is contained in:
@ -38,6 +38,8 @@ extern "C" {
|
||||
|
||||
#ifdef ESP8266
|
||||
#include <Hash.h>
|
||||
#elif defined(ESP32)
|
||||
#include <hwcrypto/sha.h>
|
||||
#else
|
||||
|
||||
extern "C" {
|
||||
@ -483,6 +485,9 @@ String WebSockets::acceptKey(String & clientKey) {
|
||||
uint8_t sha1HashBin[20] = { 0 };
|
||||
#ifdef ESP8266
|
||||
sha1(clientKey + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11", &sha1HashBin[0]);
|
||||
#elif defined(ESP32)
|
||||
String data = clientKey + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
||||
esp_sha(SHA1, (unsigned char*)data.c_str(), data.length(), &sha1HashBin[0]);
|
||||
#else
|
||||
clientKey += "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
||||
SHA1_CTX ctx;
|
||||
|
Reference in New Issue
Block a user