esp_sha() function
Calculate SHA1 or SHA2 sum of some data, using hardware SHA engine
Arguments
sha_type
SHA algorithm to use.
ilen
Length of input data in bytes.
output
Buffer for output SHA digest. Output is 20 bytes for sha_type SHA1, 32 bytes for sha_type SHA2_256, 48 bytes for sha_type SHA2_384, 64 bytes for sha_type SHA2_512.
Notes
For more versatile SHA calculations, where data doesn't need to be passed all at once, try the mbedTLS mbedtls/shaX.h APIs. The hardware-accelerated mbedTLS implementation is also faster when hashing large amounts of data. It is not necessary to lock any SHA hardware before calling this function, thread safety is managed internally. If a TLS connection is open then this function may block indefinitely waiting for a SHA engine to become available. Use the mbedTLS SHA API to avoid this problem.
esp_sha() calls 19 functions:
![]()
esp_sha()
esp_sha() reads 10 variables:
![]()
esp_sha()