/* Accepts an array of octets as the next portion of the message.  */
void ICACHE_FLASH_ATTR SHA512_Update(SHA512_CTX *ctx, const uint8_t *msg, int len)
/* Accepts an array of octets as the next portion of the message.  */
void ICACHE_FLASH_ATTR SHA512_Update(SHA512_CTX *ctx, const uint8_t *msg, int len)
{
    while (len > 0)
    {
        size_t n = MIN(len, 128 - ctx->size);
        memcpy(ctx->w_buf.buffer + ctx->size, msg, n);
        ctx->size += n;
        ctx->totalSize += n;
        msg = (uint8_t *) msg + n;
        len -= n;
        if (ctx->size == 128)
        {
            SHA512_Process(ctx);
            ctx->size = 0;
        }
    }
}