Linux-Fan

adler32 example using zlib

Nov 30th, 2013
60
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. #include <zlib.h>
  5.  
  6. #define BUF 0x200
  7.  
  8. int main(int argc, char** argv)
  9. {
  10.     unsigned char buf[BUF];
  11.     unsigned long adler = adler32(0, Z_NULL, 0);
  12.  
  13.     size_t len;
  14.     while((len = fread(buf, sizeof(unsigned char), BUF, stdin)) != 0) {
  15.         adler = adler32(adler, buf, len);
  16.     }
  17.  
  18.     printf("0x%08lx\n", adler);
  19.     return EXIT_SUCCESS;
  20. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×