dlb-David / esp32_c6_public_dlb_logger

DLB LOGGER WiFi6 standard
https://www.dlb.one
1 stars 0 forks source link

SSH1 #1

Open dlb-David opened 9 months ago

dlb-David commented 9 months ago

Fingerprint not working jet

dlb-David commented 9 months ago

https://techtutorialsx.com/2018/01/25/esp32-arduino-applying-the-hmac-sha-256-mechanism/

dlb-David commented 9 months ago

include "mbedtls/md.h" 

void setup(){    Serial.begin(115200);    char key = "secretKey";   char payload = "Hello HMAC SHA 256!";   byte hmacResult[32];    mbedtls_md_context_t ctx;   mbedtls_md_type_t md_type = MBEDTLS_MD_SHA256;    const size_t payloadLength = strlen(payload);   const size_t keyLength = strlen(key);                mbedtls_md_init(&ctx);  mbedtls_md_setup(&ctx, mbedtls_md_info_from_type(md_type), 1);   mbedtls_md_hmac_starts(&ctx, (const unsigned char ) key, keyLength);   mbedtls_md_hmac_update(&ctx, (const unsigned char ) payload, payloadLength);   mbedtls_md_hmac_finish(&ctx, hmacResult);  mbedtls_md_free(&ctx);   

Serial.print("Hash: ");   

for(int i= 0; i< sizeof(hmacResult); i++){       char str[3];        sprintf(str, "%02x", (int)hmacResult[i]);       Serial.print(str);  }} void loop(){} -- | --

dlb-David commented 9 months ago

<?php echo hash_hmac('sha256', 'The quick brown fox jumped over the lazy dog.', 'secret'); ?>

L'exemple ci-dessus va afficher :

9c5c42422b03f0ee32949920649445e417b2c634050833c5165704b825c2a53b