//https://github.com/pycom/esp-idf-2.0/blob/master/components/esp32/hwcrypto/sha.c void esp_sha(esp_sha_type sha_type, const unsigned char *input, size_t ilen, unsigned char *output) { size_t block_len = block_length(sha_type); esp_sha_lock_engine(sha_type); SHA_CTX ctx; ets_sha_init(&ctx); while(ilen > 0) { size_t chunk_len = (ilen > block_len) ? block_len : ilen; esp_sha_lock_memory_block(); esp_sha_wait_idle(); ets_sha_update(&ctx, sha_type, input, chunk_len * 8); esp_sha_unlock_memory_block(); input += chunk_len; ilen -= chunk_len; } esp_sha_lock_memory_block(); esp_sha_wait_idle(); ets_sha_finish(&ctx, sha_type, output); esp_sha_unlock_memory_block(); esp_sha_unlock_engine(sha_type); }
//https://github.com/pycom/esp-idf-2.0/blob/master/components/esp32/hwcrypto/sha.c
void esp_sha(esp_sha_type sha_type, const unsigned char *input, size_t ilen, unsigned char *output)
{
size_t block_len = block_length(sha_type);
}