From e92a2b5ab23bedb3eaeb2efab5ee4fb4c45df1f9 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 6 Feb 2008 12:48:19 -0700 Subject: [PATCH] dump-cap: include UEB_hash in output --- src/allmydata/scripts/debug.py | 8 ++++---- src/allmydata/test/test_system.py | 2 +- src/allmydata/uri.py | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/allmydata/scripts/debug.py b/src/allmydata/scripts/debug.py index cf08a206..ea2fefbe 100644 --- a/src/allmydata/scripts/debug.py +++ b/src/allmydata/scripts/debug.py @@ -34,15 +34,15 @@ def dump_share(config, out=sys.stdout, err=sys.stderr): seek = offsets['uri_extension'] length = struct.unpack(">L", f.read_share_data(seek, 4))[0] 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", "needed_shares", "total_shares") keys2 = ("codec_name", "codec_params", "tail_codec_params") keys3 = ("plaintext_hash", "plaintext_root_hash", "crypttext_hash", "crypttext_root_hash", - "share_root_hash") + "share_root_hash", "UEB_hash") display_keys = {"size": "file_size"} for k in keys1: if k in unpacked: @@ -70,7 +70,7 @@ def dump_share(config, out=sys.stdout, err=sys.stderr): sizes['data'] = bp._data_size sizes['validation'] = (offsets['uri_extension'] - offsets['plaintext_hash_tree']) - sizes['uri-extension'] = len(data) + sizes['uri-extension'] = len(UEB_data) print >>out print >>out, "Size of data within the share:" for k in sorted(sizes): diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 04b69eab..8f669f6c 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -1155,7 +1155,7 @@ class SystemTest(testutil.SignalMixin, testutil.PollMixin, unittest.TestCase): "codec_name", "codec_params", "tail_codec_params", "plaintext_hash", "plaintext_root_hash", "crypttext_hash", "crypttext_root_hash", - "share_root_hash",): + "share_root_hash", "UEB_hash"): self.failUnless("%s: " % key in output, key) def _test_control(self, res): diff --git a/src/allmydata/uri.py b/src/allmydata/uri.py index 44df1f48..a630f188 100644 --- a/src/allmydata/uri.py +++ b/src/allmydata/uri.py @@ -508,6 +508,7 @@ def unpack_extension(data): def unpack_extension_readable(data): unpacked = unpack_extension(data) + unpacked["UEB_hash"] = hashutil.uri_extension_hash(data) for k in sorted(unpacked.keys()): if 'hash' in k: unpacked[k] = idlib.b2a(unpacked[k]) -- 2.45.2