[Numpy-discussion] checksum on numpy float array

josef.pktd@gmai... josef.pktd@gmai...
Thu Dec 4 17:57:24 CST 2008


I didn't check what this does behind the scenes, but try this

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


More information about the Numpy-discussion mailing list