Rev 20: Use Network Endian order for struct.unpack() to ensure consistency across platforms. in http://bzr.arbash-meinel.com/plugins/pybloom

John Arbash Meinel john at arbash-meinel.com
Thu Apr 26 23:12:20 BST 2007


At http://bzr.arbash-meinel.com/plugins/pybloom

------------------------------------------------------------
revno: 20
revision-id: john at arbash-meinel.com-20070426221217-3n8ut1rxh7ncamhh
parent: john at arbash-meinel.com-20070426221002-mmwu0z30xzc1b3ks
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: pybloom
timestamp: Thu 2007-04-26 17:12:17 -0500
message:
  Use Network Endian order for struct.unpack() to ensure consistency across platforms.
modified:
  pybloom.py                     pybloom.py-20061013005844-b3v176fajvw2xeip-1
-------------- next part --------------
=== modified file 'pybloom.py'
--- a/pybloom.py	2007-04-26 22:10:02 +0000
+++ b/pybloom.py	2007-04-26 22:12:17 +0000
@@ -213,7 +213,7 @@
         hash_val = md5.new(val).digest()
         # break it up into 4 32-bit offsets
         # and strip off the unused bits
-        return [h & self._bitmask for h in struct.unpack('4i', hash_val)]
+        return [h & self._bitmask for h in struct.unpack('>4i', hash_val)]
 
 
 class BloomSHA1(Bloom):
@@ -238,7 +238,7 @@
         hash_val = sha.new(val).digest()
         # break it up into 5 32-bit offsets
         # and strip off the unused bits
-        return [h & self._bitmask for h in struct.unpack('5i', hash_val)]
+        return [h & self._bitmask for h in struct.unpack('>5i', hash_val)]
 
 
 # This was the original implementation by



More information about the bazaar-commits mailing list