md5_stream (std::FILE* stream, void* resblock)
md5_stream (FILE* stream, void* resblock)
md5_stream (std::FILE* stream, void* resblock){  /* Important: BLOCKSIZE must be a multiple of 64.  */#define BLOCKSIZE 4096  struct md5_ctx ctx;  char buffer[BLOCKSIZE + 72];  std::size_t sum;  /* Initialize the computation context.  */  md5_init_ctx (&ctx);  /* Iterate over full file contents.  */  while (1)    {      /* We read the file in blocks of BLOCKSIZE bytes.  One call of the     computation function processes the whole buffer so that with the     next round of the loop another block can be read.  */      std::size_t n;      sum = 0;      /* Read block.  Take care for partial reads.  */      do    {      n = std::fread (buffer + sum, 1, BLOCKSIZE - sum, stream);      sum += n;    }      while (sum < BLOCKSIZE && n != 0);      if (n == 0 && std::ferror (stream))        return 1;      /* If end of file is reached, end the loop.  */      if (n == 0)    break;      /* Process buffer with BLOCKSIZE bytes.  Note that            BLOCKSIZE % 64 == 0       */      md5_process_block (buffer, BLOCKSIZE, &ctx);    }  /* Add the last bytes if necessary.  */  if (sum > 0)    md5_process_bytes (buffer, sum, &ctx);  /* Construct result in desired memory.  */  md5_finish_ctx (&ctx, resblock);  return 0;}