Here is the code as shown below:
#include <stdio.h>
#include"sha256.h"
#include <string.h>
uint8_t hash256[32];
int main()
{
    printf("\nminerando bloco...\n");
    char entrada[50] = "Hello World";
    char *str;
    char sha256_str[65];
    int nonce = 0;
    int i;
    do {
        sprintf(str, "%d", nonce);
        strcat(str, entrada);
        sha256_simple((const uint8_t *)(str), strlen(str), hash256);
        for (i = 0; i < 32; ++i)
        {
            //printf("%02x", hash256[i]);
            snprintf(sha256_str + i *2, 2 + 1, "%02x", hash256[i]);
        }
        nonce++;
    } while (sha256_str[0] != '0' || sha256_str[1] != '0' || sha256_str[2] != '0' || sha256_str[3] != '0' || sha256_str[4] != '0'); //dificuldade 4
    printf("\nNONCE:\t%d", nonce);
    printf("\nDATA:\t%s", entrada);
    printf("\nHASH:\t%s\n", sha256_str);
    return 0;
}
When I run the program it gives me segmentation fault in here:
snprintf(sha256_str + i *2, 2 + 1, "%02x", hash256[i]);
 
     
    