#define SHA256_ROTL(a,b) (((a>>(32-b))&(0x7fffffff>>(31-b)))|(a<<b))
#define SHA256_SR(a,b) ((a>>b)&(0x7fffffff>>(b-1)))
#define SHA256_Ch(x,y,z) ((x&y)^((~x)&z))
#define SHA256_Maj(x,y,z) ((x&y)(x&z)(y&z))
#define SHA256_E0(x) (SHA256_ROTL(x,30)SHA256_ROTL(x,19)SHA256_ROTL(x,10))
#define SHA256_E1(x) (SHA256_ROTL(x,26)SHA256_ROTL(x,21)SHA256_ROTL(x,7))
#define SHA256_O0(x) (SHA256_ROTL(x,25)SHA256_ROTL(x,14)SHA256_SR(x,3))
#define SHA256_O1(x) (SHA256_ROTL(x,15)SHA256_ROTL(x,13)SHA256_SR(x,10))
void StrSHA256(const unsigned char* str, uint32_t length, unsigned char* sha256)
{
unsigned char *pp, *ppend;
unsigned char q[256];
static uint32_t l, i, W[64], T1, T2, A, B, C, D, E, F, G, H, H0, H1, H2, H3, H4, H5, H6, H7;
uint32_t Key[64] = {
0x428a2f98, 0x71374491, 0xb5c0f