Skip to content

feat(hash): Add hashing library and new algorithms #11676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lucasssvaz
Copy link
Collaborator

@lucasssvaz lucasssvaz commented Jul 30, 2025

Description of Change

Move hashing algorithms and examples into a Hash library. Some files are required to stay in the core as they are used by core files. The inner structure of the base class was also revised.

Also, all the available algorithms in the repo have some flaw and are not considered secure. To address that, this PR also adds support for the SHA2, SHA3 and PBKDF2_HMAC algorithms.

This will be required to fix some vulnerabilities found by CodeQL.

Tests scenarios

Tested locally

@lucasssvaz lucasssvaz self-assigned this Jul 30, 2025
@lucasssvaz lucasssvaz added the Area: Libraries Issue is related to Library support. label Jul 30, 2025
Copy link
Contributor

github-actions bot commented Jul 30, 2025

Messages
📖 This PR seems to be quite large (total lines of code: 2000), you might consider splitting it into smaller PRs

👋 Hello lucasssvaz, we appreciate your contribution to this project!


📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Addressing info messages (📖) is strongly recommended; they're less critical but valuable.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 1038921

Copy link
Contributor

github-actions bot commented Jul 30, 2025

Test Results

 76 files   76 suites   13m 16s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commit 1038921.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Jul 31, 2025

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32C5💚 -4280💚 -0.040.00000.000.00
ESP32P4000.000.00000.000.00
ESP32S3💚 -960💚 -0.030.00000.000.00
ESP32S2💚 -960💚 -0.040.00000.000.00
ESP32C3000.000.00000.000.00
ESP32C6💚 -4280💚 -0.040.00000.000.00
ESP32H2000.000.00000.000.00
ESP32💚 -96⚠️ +492💚 -0.03⚠️ +0.05000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32C5ESP32P4ESP32S3ESP32S2ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
EEPROM/examples/eeprom_class00--💚 -960--000000💚 -960
EEPROM/examples/eeprom_extra00--💚 -960--000000💚 -960
EEPROM/examples/eeprom_write00--00--00000000
ESP32/examples/AnalogOut/LEDCFade00--00--00000000
ESP32/examples/AnalogOut/LEDCGammaFade00--------0000--
ESP32/examples/AnalogOut/LEDCSingleChannel00--00--00000000
ESP32/examples/AnalogOut/LEDCSoftwareFade00--00--00000000
ESP32/examples/AnalogOut/SigmaDelta000000--00000000
ESP32/examples/AnalogOut/ledcFrequency000000--00000000
ESP32/examples/AnalogOut/ledcWrite_RGB000000--00000000
ESP32/examples/AnalogRead000000--00000000
ESP32/examples/AnalogReadContinuous0000000000000000
ESP32/examples/ArduinoStackSize0000000000000000
ESP32/examples/CI/CIBoardsTest0000000000000000
ESP32/examples/ChipID/GetChipID0000💚 -960💚 -960000000💚 -960
ESP32/examples/DeepSleep/TimerWakeUp000000000000--00
ESP32/examples/FreeRTOS/BasicMultiThreading0000000000000000
ESP32/examples/FreeRTOS/Mutex0000000000000000
ESP32/examples/FreeRTOS/Queue0000000000000000
ESP32/examples/FreeRTOS/Semaphore0000000000000000
ESP32/examples/GPIO/BlinkRGB0000000000000000
ESP32/examples/GPIO/FunctionalInterrupt0000000000000000
ESP32/examples/GPIO/FunctionalInterruptLambda0000000000000000
ESP32/examples/GPIO/FunctionalInterruptStruct0000000000000000
ESP32/examples/GPIO/GPIOInterrupt0000000000000000
ESP32/examples/HWCDC_Events000000--000000--
ESP32/examples/MacAddress/GetMacAddress0000000000000000
ESP32/examples/RMT/Legacy_RMT_Driver_Compatible0000000000000000
ESP32/examples/RMT/RMTCallback0000000000000000
ESP32/examples/RMT/RMTLoopback0000000000000000
ESP32/examples/RMT/RMTReadXJT0000000000000000
ESP32/examples/RMT/RMTWrite_RGB_LED0000000000000000
ESP32/examples/RMT/RMT_CPUFreq_Test0000000000000000
ESP32/examples/RMT/RMT_EndOfTransmissionState0000000000000000
ESP32/examples/RMT/RMT_LED_Blink0000000000000000
ESP32/examples/ResetReason/ResetReason0000000000000000
ESP32/examples/ResetReason/ResetReason20000000000000000
ESP32/examples/Serial/BaudRateDetect_Demo0000000000000000
ESP32/examples/Serial/OnReceiveError_BREAK_Demo0000000000000000
ESP32/examples/Serial/OnReceive_Demo0000000000000000
ESP32/examples/Serial/RS485_Echo_Demo000000000000--00
ESP32/examples/Serial/RxFIFOFull_Demo000000000000--00
ESP32/examples/Serial/RxTimeout_Demo000000000000--00
ESP32/examples/Serial/Serial_All_CPU_Freqs000000000000--00
ESP32/examples/Serial/Serial_STD_Func_OnReceive000000000000--00
ESP32/examples/Serial/onReceiveExample000000000000--00
ESP32/examples/Template/ExampleTemplate000000000000--00
ESP32/examples/Time/SimpleTime000000000000----
ESP32/examples/Timer/RepeatTimer000000000000----
ESP32/examples/Timer/WatchdogTimer000000000000----
ESP_I2S/examples/ES8388_loopback00--00000000----
ESP_I2S/examples/Simple_tone00--00000000----
ESP_NOW/examples/ESP_NOW_Broadcast_Master00--💚 -960💚 -9600000----
ESP_NOW/examples/ESP_NOW_Broadcast_Slave00--💚 -960💚 -960--00----
ESP_NOW/examples/ESP_NOW_Network00--💚 -960💚 -880--00----
ESP_NOW/examples/ESP_NOW_Serial00--0000--00----
ESPmDNS/examples/mDNS-SD_Extended00----00--00----
ESPmDNS/examples/mDNS_Web_Server00----00--00----
Ethernet/examples/ETH_W5500_Arduino_SPI00----00--00----
Ethernet/examples/ETH_W5500_IDF_SPI00----00--00----
Ethernet/examples/ETH_WIFI_BRIDGE00----00--00----
FFat/examples/FFat_Test00----00--00----
FFat/examples/FFat_time00----00--------
HTTPClient/examples/Authorization00----00--------
RainMaker/examples/RMakerCustomAirCooler00------0000----
RainMaker/examples/RMakerSonoffDualR300------0000----
RainMaker/examples/RMakerSwitch00------0000----
SD/examples/SD_Test00--💚 -320--0000--00
SD/examples/SD_time00--00--0000----
SPI/examples/SPI_Multiple_Buses00--00--0000----
SPIFFS/examples/SPIFFS_Test00--00----00----
SPIFFS/examples/SPIFFS_time00--00----00----
TFLiteMicro/examples/hello_world00000000--00----
Ticker/examples/Blinker00000000--00----
Ticker/examples/TickerBasic00000000--00----
Ticker/examples/TickerParameter00000000--00----
Update/examples/AWS_S3_OTA_Update💚 -4200--------💚 -4280----
Update/examples/HTTPS_OTA_Update💚 -4200--------💚 -4280----
Update/examples/HTTP_Client_AES_OTA_Update💚 -4280--------------
Update/examples/HTTP_Server_AES_OTA_Update💚 -4280--------------
ESP32/examples/DeepSleep/TouchWakeUp--000000------00
ESP32/examples/TWAI/TWAIreceive--0000000000--00
ESP32/examples/TWAI/TWAItransmit--0000000000--00
ESP32/examples/Touch/TouchInterrupt--000000--------
ESP32/examples/Touch/TouchRead--000000--------
USB/examples/CompositeDevice--000000--------
USB/examples/ConsumerControl--000000--------
USB/examples/CustomHIDDevice--000000--------
USB/examples/FirmwareMSC--000000--------
USB/examples/Gamepad--00--00--------
USB/examples/HIDVendor--00--00--------
USB/examples/Keyboard/KeyboardLogout--00--00--------
USB/examples/Keyboard/KeyboardMessage--00--00--------
ESP32/examples/Camera/CameraWebServer (1)----0000------00
ESP32/examples/Camera/CameraWebServer (2)----0000------00
ESP32/examples/Camera/CameraWebServer (3)----00----------
ESP32/examples/DeepSleep/ExternalWakeUp----0000------00
ESP_I2S/examples/Record_to_WAV----00----------
ESP_SR/examples/Basic----00----------
SD_MMC/examples/SD2USBMSC----00----------
SD_MMC/examples/SDMMC_Test----00----------
SD_MMC/examples/SDMMC_time----00----------
HTTPClient/examples/BasicHttpClient------00--------
USB/examples/Keyboard/KeyboardReprogram------00--------
USB/examples/Keyboard/KeyboardSerial------00--------
USB/examples/KeyboardAndMouseControl------00--------
BLE/examples/iBeacon--------00--00--
DNSServer/examples/CaptivePortal--------00----⚠️ +4920
NetworkClientSecure/examples/WiFiClientSecureProtocolUpgrade--------00----00
NetworkClientSecure/examples/WiFiClientShowPeerCredentials--------00----💚 -960
NetworkClientSecure/examples/WiFiClientTrustOnFirstUse--------00----💚 -960
PPP/examples/PPP_Basic--------00----00
PPP/examples/PPP_WIFI_BRIDGE--------00----00
Preferences/examples/Prefs2Struct--------00----00
Preferences/examples/StartCounter--------0000--💚 -960
RainMaker/examples/RMakerCustom--------0000----
Matter/examples/MatterSmartButon------------00--
Matter/examples/MatterTemperatureLight------------00--
Matter/examples/MatterTemperatureSensor------------0000
Matter/examples/MatterThermostat------------0000
OpenThread/examples/CLI/COAP/coap_lamp------------00--
OpenThread/examples/CLI/COAP/coap_switch------------00--
OpenThread/examples/CLI/SimpleCLI------------00--
OpenThread/examples/CLI/SimpleNode------------00--
OpenThread/examples/CLI/SimpleThreadNetwork/ExtendedRouterNode------------00--
OpenThread/examples/CLI/SimpleThreadNetwork/LeaderNode------------00--
BluetoothSerial/examples/DiscoverConnect--------------00
BluetoothSerial/examples/GetLocalMAC--------------00
BluetoothSerial/examples/SerialToSerialBT--------------00
BluetoothSerial/examples/SerialToSerialBTM--------------00
BluetoothSerial/examples/SerialToSerialBT_Legacy--------------00
BluetoothSerial/examples/SerialToSerialBT_SSP--------------00
BluetoothSerial/examples/bt_classic_device_discovery--------------00
BluetoothSerial/examples/bt_remove_paired_devices--------------00
ESP32/examples/DeepSleep/SmoothBlink_ULP_Code--------------00
NetBIOS/examples/ESP_NBNST--------------00
NetworkClientSecure/examples/WiFiClientInsecure--------------00
NetworkClientSecure/examples/WiFiClientPSK--------------00
NetworkClientSecure/examples/WiFiClientSecure--------------00
NetworkClientSecure/examples/WiFiClientSecureEnterprise--------------💚 -960

@lucasssvaz lucasssvaz marked this pull request as ready for review July 31, 2025 02:45
@lucasssvaz lucasssvaz force-pushed the feat/hashing branch 2 times, most recently from 7feefec to e10fe12 Compare August 1, 2025 21:12
@lucasssvaz lucasssvaz changed the title feat(hash): Add hashing library and SHA3 algorithm feat(hash): Add hashing library and new algorithms Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Libraries Issue is related to Library support.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant