[Numpy-discussion] checksum on numpy float array

Brennan Williams brennan.williams@visualreservoir....
Thu Dec 4 20:29:08 CST 2008

Robert Kern wrote:
> On Thu, Dec 4, 2008 at 18:54, Brennan Williams
> <brennan.williams@visualreservoir.com> wrote:
>> Thanks
>> josef.pktd@gmail.com wrote:
>>> I didn't check what this does behind the scenes, but try this
>> import hashlib #standard python library
>> import numpy as np
>>> m = hashlib.md5()
>>> m.update(np.array(range(100)))
>>> m.update(np.array(range(200)))
> I would recommend doing this on the strings before you make arrays
> from them. You don't know if the network cut out in the middle of an
> 8-byte double.
> Of course, sending the lengths and other metadata first, then the data
> would let you check without needing to do expensivish hashes or
> checksums. If truncation is your problem rather than corruption, then
> that would be sufficient. You may also consider using the NPY format
> in numpy 1.2 to implement that.
Thanks for the ideas. I'm definitely going to add some more basic checks 
on lengths etc as well.
Unfortunately the problem is happening at a client site  so  (a) I can't 
reproduce it and (b) most of the
time they can't reproduce it either. This is a Windows Python app 
running on Citrix reading/writing data
to a Linux networked drive.


More information about the Numpy-discussion mailing list