Advertisement
rfmonk

zlib_checksums.py

Jan 30th, 2014
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. #1/usr/bin/env python
  2.  
  3. # this is from The Python
  4. # Standard Library by example
  5. # ISBN13: 9780321767349
  6.  
  7. import zlib
  8.  
  9. data = open('lorem.txt', 'r').read()
  10.  
  11. cksum = zlib.adler32(data)
  12. print 'Adler32: %12d' % cksum
  13. print '       : %12d' % zlib.adler32(data, cksum)
  14.  
  15. cksum = zlib.crc32(data)
  16. print 'CRC-32 : %12d' % cksum
  17. print '       : %12d' % zlib.crc32(data, cksum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement