mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 03:06:33 +00:00
dump-cap: include UEB_hash in output
This commit is contained in:
parent
40c2371e77
commit
e92a2b5ab2
@ -34,15 +34,15 @@ def dump_share(config, out=sys.stdout, err=sys.stderr):
|
|||||||
seek = offsets['uri_extension']
|
seek = offsets['uri_extension']
|
||||||
length = struct.unpack(">L", f.read_share_data(seek, 4))[0]
|
length = struct.unpack(">L", f.read_share_data(seek, 4))[0]
|
||||||
seek += 4
|
seek += 4
|
||||||
data = f.read_share_data(seek, length)
|
UEB_data = f.read_share_data(seek, length)
|
||||||
|
|
||||||
unpacked = uri.unpack_extension_readable(data)
|
unpacked = uri.unpack_extension_readable(UEB_data)
|
||||||
keys1 = ("size", "num_segments", "segment_size",
|
keys1 = ("size", "num_segments", "segment_size",
|
||||||
"needed_shares", "total_shares")
|
"needed_shares", "total_shares")
|
||||||
keys2 = ("codec_name", "codec_params", "tail_codec_params")
|
keys2 = ("codec_name", "codec_params", "tail_codec_params")
|
||||||
keys3 = ("plaintext_hash", "plaintext_root_hash",
|
keys3 = ("plaintext_hash", "plaintext_root_hash",
|
||||||
"crypttext_hash", "crypttext_root_hash",
|
"crypttext_hash", "crypttext_root_hash",
|
||||||
"share_root_hash")
|
"share_root_hash", "UEB_hash")
|
||||||
display_keys = {"size": "file_size"}
|
display_keys = {"size": "file_size"}
|
||||||
for k in keys1:
|
for k in keys1:
|
||||||
if k in unpacked:
|
if k in unpacked:
|
||||||
@ -70,7 +70,7 @@ def dump_share(config, out=sys.stdout, err=sys.stderr):
|
|||||||
sizes['data'] = bp._data_size
|
sizes['data'] = bp._data_size
|
||||||
sizes['validation'] = (offsets['uri_extension'] -
|
sizes['validation'] = (offsets['uri_extension'] -
|
||||||
offsets['plaintext_hash_tree'])
|
offsets['plaintext_hash_tree'])
|
||||||
sizes['uri-extension'] = len(data)
|
sizes['uri-extension'] = len(UEB_data)
|
||||||
print >>out
|
print >>out
|
||||||
print >>out, "Size of data within the share:"
|
print >>out, "Size of data within the share:"
|
||||||
for k in sorted(sizes):
|
for k in sorted(sizes):
|
||||||
|
@ -1155,7 +1155,7 @@ class SystemTest(testutil.SignalMixin, testutil.PollMixin, unittest.TestCase):
|
|||||||
"codec_name", "codec_params", "tail_codec_params",
|
"codec_name", "codec_params", "tail_codec_params",
|
||||||
"plaintext_hash", "plaintext_root_hash",
|
"plaintext_hash", "plaintext_root_hash",
|
||||||
"crypttext_hash", "crypttext_root_hash",
|
"crypttext_hash", "crypttext_root_hash",
|
||||||
"share_root_hash",):
|
"share_root_hash", "UEB_hash"):
|
||||||
self.failUnless("%s: " % key in output, key)
|
self.failUnless("%s: " % key in output, key)
|
||||||
|
|
||||||
def _test_control(self, res):
|
def _test_control(self, res):
|
||||||
|
@ -508,6 +508,7 @@ def unpack_extension(data):
|
|||||||
|
|
||||||
def unpack_extension_readable(data):
|
def unpack_extension_readable(data):
|
||||||
unpacked = unpack_extension(data)
|
unpacked = unpack_extension(data)
|
||||||
|
unpacked["UEB_hash"] = hashutil.uri_extension_hash(data)
|
||||||
for k in sorted(unpacked.keys()):
|
for k in sorted(unpacked.keys()):
|
||||||
if 'hash' in k:
|
if 'hash' in k:
|
||||||
unpacked[k] = idlib.b2a(unpacked[k])
|
unpacked[k] = idlib.b2a(unpacked[k])
|
||||||
|
Loading…
Reference in New Issue
Block a user