473,467 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

doing "checksum" in python

is there a built-in function that does a "checksum" on a file...basicly
counts the bytes and computes a 16-bit checksum for each given FILE.

this is the like the "sum" command in unix

Jul 18 '05 #1
2 9134
GujuBoy wrote:
is there a built-in function that does a "checksum" on a file...basicly
counts the bytes and computes a 16-bit checksum for each given FILE.

this is the like the "sum" command in unix

Try zlib.adler32 or zlib.crc32 ...?
import zlib
zlib.crc32(open("c:\\boot.ini").read())

-1176164168

--Irmen
Jul 18 '05 #2
On 28 Mar 2005 15:11:32 -0800, GujuBoy <di*****@gmail.com> wrote:
is there a built-in function that does a "checksum" on a file...basicly
counts the bytes and computes a 16-bit checksum for each given FILE.

this is the like the "sum" command in unix

--
http://mail.python.org/mailman/listinfo/python-list


Not built-in, but you can find a few implementations with a quick
google search for "python 16-bit checksum":
http://mail.python.org/pipermail/pyt...ay/042691.html
http://mail.python.org/pipermail/pyt...ry/204983.html
http://mail.python.org/pipermail/pyt...ry/204998.html

--
Sean Blakey
Saint of Mild Amusement, Evil Genius, Big Geek
Python/Java/C++/C(Unix/Windows/Palm/Web) developer
quine = ['print "quine =",quine,"; exec(quine[0])"'] ; exec(quine[0])
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: Stephen Ferg | last post by:
I am a very satisfied user of Python and have been for number of years. I would never willing use another language. I wish all good things for Python, and that moves me to express some thoughts...
10
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. ...
26
by: Michel Rouzic | last post by:
I have a binary file used to store the values of variables in order to use them again. I easily know whether the file exists or not, but the problem is, in case the program has been earlier...
24
by: BBands | last post by:
I have some CDs and have been archiving them on a PC. I wrote a Python script that spans the archive and returns a list of its contents: ...]. I wanted to add a search function to locate all the...
6
by: Gonzalo Monzón | last post by:
Hi all! I have been translating some Python custom C extension code into Python, as I need these modules to be portable and run on a PocketPC without the need of compile (for the purpose its a...
0
rishidadhich
by: rishidadhich | last post by:
Hello, Can any one help me how to get "CheckSum" of a webpage using PHP. thanx Rishi.
4
by: kkwweett | last post by:
Hi, the download page (http://www.python.org/download/releases/3.0/) for Python 3000 shows : 9119625244b17aa35ed94b655a2b2135 13491200 python-3.0b1.msi but I got ...
2
by: hypermonkey2 | last post by:
Hi there! I am using the "shelve" module in a script to save information in between runtime sessions of the program. (its a sort of data collector, so its important to hold on to anything computed...
1
by: Slaunger | last post by:
Hi, This is my first post here, I am looking forward to being here. I have actually posted almost the same question on comp.lang.python: ...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.