/* Accepts an array of octets as the next portion of the message.  */
void ICACHE_FLASH_ATTR SHA256_Update(SHA256_CTX *ctx, const uint8_t *msg, int len)
/* Accepts an array of octets as the next portion of the message.  */
void ICACHE_FLASH_ATTR SHA256_Update(SHA256_CTX *ctx, const uint8_t *msg, int len)
{
    uint32_t left = ctx->total[0] & 0x3F;
    uint32_t fill = 64 - left;
    ctx->total[0] += len;
    ctx->total[0] &= 0xFFFFFFFF;
    if (ctx->total[0] < len)
        ctx->total[1]++;
    if (left && len >= fill)
    {
        memcpy((void *) (ctx->buffer + left), (void *)msg, fill);
        SHA256_Process(ctx->buffer, ctx);
        len -= fill;
        msg  += fill;
        left = 0;
    }
    while (len >= 64)
    {
        SHA256_Process(msg, ctx);
        len -= 64;
        msg  += 64;
    }
    if (len)
    {
        memcpy((void *) (ctx->buffer + left), (void *) msg, len);
    }
}