[Numpy-discussion] checksum on numpy float array

Brennan Williams brennan.williams@visualreservoir....
Thu Dec 4 18:54:44 CST 2008


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)))
>
> m2 = hashlib.md5()
> m2.update(np.array(range(100)))
> m2.update(np.array(range(200)))
>
> print m.hexdigest()
> print m2.hexdigest()
>
> assert  m.hexdigest() == m2.hexdigest()
>
> m3 = hashlib.md5()
> m3.update(np.array(range(100)))
> m3.update(np.array(range(199)))
>
> print m3.hexdigest()
>
> assert  m.hexdigest() == m3.hexdigest()
>
> Josef
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>   



More information about the Numpy-discussion mailing list