mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-03-22 19:55:16 +00:00
Respond to review
- Preserve int division - Dial back the __future__ imports
This commit is contained in:
parent
42eaf08a52
commit
3ae927eab9
@ -1,7 +1,4 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
__all__ = [
|
||||
"SyncTestCase",
|
||||
@ -961,12 +958,12 @@ def _corrupt_offset_of_block_hashes_to_truncate_crypttext_hashes(data, debug=Fal
|
||||
assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
|
||||
if sharevernum == 1:
|
||||
curval = struct.unpack(">L", data[0x0c+0x18:0x0c+0x18+4])[0]
|
||||
newval = random.randrange(0, max(1, (curval/hashutil.CRYPTO_VAL_SIZE)//2))*hashutil.CRYPTO_VAL_SIZE
|
||||
newval = random.randrange(0, max(1, (curval//hashutil.CRYPTO_VAL_SIZE)//2))*hashutil.CRYPTO_VAL_SIZE
|
||||
newvalstr = struct.pack(">L", newval)
|
||||
return data[:0x0c+0x18]+newvalstr+data[0x0c+0x18+4:]
|
||||
else:
|
||||
curval = struct.unpack(">Q", data[0x0c+0x2c:0x0c+0x2c+8])[0]
|
||||
newval = random.randrange(0, max(1, (curval/hashutil.CRYPTO_VAL_SIZE)//2))*hashutil.CRYPTO_VAL_SIZE
|
||||
newval = random.randrange(0, max(1, (curval//hashutil.CRYPTO_VAL_SIZE)//2))*hashutil.CRYPTO_VAL_SIZE
|
||||
newvalstr = struct.pack(">Q", newval)
|
||||
return data[:0x0c+0x2c]+newvalstr+data[0x0c+0x2c+8:]
|
||||
|
||||
|
@ -1,7 +1,4 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
from random import randrange
|
||||
|
Loading…
x
Reference in New Issue
Block a user