[tor-commits] [stem/master] Change fingerprints and digests to upper-case hex.
atagar at torproject.org
atagar at torproject.org
Wed Feb 20 16:49:51 UTC 2013
commit be9a5323a37ea0f1b7d497d7fc33e101453eb2cf
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Wed Feb 20 12:26:29 2013 +0100
Change fingerprints and digests to upper-case hex.
---
stem/descriptor/extrainfo_descriptor.py | 9 +++++----
stem/descriptor/router_status_entry.py | 6 +++---
stem/descriptor/server_descriptor.py | 6 +++---
test/integ/descriptor/networkstatus.py | 16 ++++++++--------
test/unit/descriptor/router_status_entry.py | 4 ++--
5 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/stem/descriptor/extrainfo_descriptor.py b/stem/descriptor/extrainfo_descriptor.py
index cc779b8..dce95a5 100644
--- a/stem/descriptor/extrainfo_descriptor.py
+++ b/stem/descriptor/extrainfo_descriptor.py
@@ -31,7 +31,7 @@ Extra-info descriptors are available from a few sources...
| |- RelayExtraInfoDescriptor - Extra-info descriptor for a relay.
| +- BridgeExtraInfoDescriptor - Extra-info descriptor for a bridge.
|
- |- digest - calculates the digest value for our content
+ |- digest - calculates the upper-case hex digest value for our content
+- get_unrecognized_lines - lines with unrecognized content
.. data:: DirResponse (enum)
@@ -783,10 +783,11 @@ class ExtraInfoDescriptor(stem.descriptor.Descriptor):
def digest(self):
"""
- Provides the hex encoded sha1 of our content. This value is part of the
- server descriptor entry for this relay.
+ Provides the upper-case hex encoded sha1 of our content. This value is part
+ of the server descriptor entry for this relay.
- :returns: **str** with the digest value for this server descriptor
+ :returns: **str** with the upper-case hex digest value for this server
+ descriptor
"""
raise NotImplementedError("Unsupported Operation: this should be implemented by the ExtraInfoDescriptor subclass")
diff --git a/stem/descriptor/router_status_entry.py b/stem/descriptor/router_status_entry.py
index 4bdef70..ca548b1 100644
--- a/stem/descriptor/router_status_entry.py
+++ b/stem/descriptor/router_status_entry.py
@@ -248,7 +248,7 @@ class RouterStatusEntryV2(RouterStatusEntry):
Information about an individual router stored within a version 2 network
status document.
- :var str digest: **\*** router's digest
+ :var str digest: **\*** router's upper-case hex digest
**\*** attribute is either required when we're parsed with validation or has
a default value, others are left as **None** if undefined
@@ -303,7 +303,7 @@ class RouterStatusEntryV3(RouterStatusEntry):
:var list addresses_v6: **\*** relay's OR addresses, this is a tuple listing
of the form (address (**str**), port (**int**), is_ipv6 (**bool**))
- :var str digest: **\*** router's digest
+ :var str digest: **\*** router's upper-case hex digest
:var int bandwidth: bandwidth claimed by the relay (in kb/s)
:var int measured: bandwidth measured to be available by the relay
@@ -500,7 +500,7 @@ def _parse_r_line(desc, value, validate, include_digest = True):
desc.fingerprint = _decode_fingerprint(r_comp[1], validate)
if include_digest:
- desc.digest = r_comp[2]
+ desc.digest = _decode_fingerprint(r_comp[2], validate)
desc.address = r_comp[5]
desc.or_port = int(r_comp[6])
diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py
index 9cecb23..2db9a49 100644
--- a/stem/descriptor/server_descriptor.py
+++ b/stem/descriptor/server_descriptor.py
@@ -23,7 +23,7 @@ etc). This information is provided from a few sources...
| |- is_scrubbed - checks if our content has been properly scrubbed
| +- get_scrubbing_issues - description of issues with our scrubbing
|
- |- digest - calculates the digest value for our content
+ |- digest - calculates the upper-case hex digest value for our content
|- get_unrecognized_lines - lines with unrecognized content
|- get_annotations - dictionary of content prior to the descriptor entry
+- get_annotation_lines - lines that provided the annotations
@@ -170,7 +170,7 @@ class ServerDescriptor(stem.descriptor.Descriptor):
:var bool hibernating: **\*** hibernating when published
:var bool allow_single_hop_exits: **\*** flag if single hop exiting is allowed
:var bool extra_info_cache: **\*** flag if a mirror for extra-info documents
- :var str extra_info_digest: hex encoded digest of our extra-info document
+ :var str extra_info_digest: upper-case hex encoded digest of our extra-info document
:var bool eventdns: flag for evdns backend (deprecated, always unset)
:var list address_alt: alternative for our address/or_port attributes, each
entry is a tuple of the form (address (**str**), port (**int**), is_ipv6
@@ -277,7 +277,7 @@ class ServerDescriptor(stem.descriptor.Descriptor):
Provides the hex encoded sha1 of our content. This value is part of the
network status entry for this relay.
- :returns: **str** with the digest value for this server descriptor
+ :returns: **str** with the upper-case hex digest value for this server descriptor
"""
raise NotImplementedError("Unsupported Operation: this should be implemented by the ServerDescriptor subclass")
diff --git a/test/integ/descriptor/networkstatus.py b/test/integ/descriptor/networkstatus.py
index 9f68eba..6bfd137 100644
--- a/test/integ/descriptor/networkstatus.py
+++ b/test/integ/descriptor/networkstatus.py
@@ -125,7 +125,7 @@ class TestNetworkStatus(unittest.TestCase):
router = next(descriptors)
self.assertEquals("sumkledi", router.nickname)
self.assertEquals("0013D22389CD50D0B784A3E4061CB31E8CE8CEB5", router.fingerprint)
- self.assertEquals("8mCr8Sl7RF4ENU4jb0FZFA/3do8", router.digest)
+ self.assertEquals("F260ABF1297B445E04354E236F4159140FF7768F", router.digest)
self.assertEquals(datetime.datetime(2012, 7, 12, 4, 1, 55), router.published)
self.assertEquals("178.218.213.229", router.address)
self.assertEquals(80, router.or_port)
@@ -142,7 +142,7 @@ class TestNetworkStatus(unittest.TestCase):
router = next(stem.descriptor.parse_file(descriptor_file))
self.assertEquals("Unnamed", router.nickname)
self.assertEquals("0014A2055278DB3EB0E59EA701741416AF185558", router.fingerprint)
- self.assertEquals("FI74aFuNJZZQrgln0f+OaocMd0M", router.digest)
+ self.assertEquals("148EF8685B8D259650AE0967D1FF8E6A870C7743", router.digest)
self.assertEquals(datetime.datetime(2012, 5, 31, 15, 57, 0), router.published)
self.assertEquals("10.97.236.247", router.address)
self.assertEquals(443, router.or_port)
@@ -264,7 +264,7 @@ I/TJmV928na7RLZe2mGHCAW3VQOvV+QkCfj05VZ8CsY=
router = document.routers[0]
self.assertEquals("sumkledi", router.nickname)
self.assertEquals("0013D22389CD50D0B784A3E4061CB31E8CE8CEB5", router.fingerprint)
- self.assertEquals("8mCr8Sl7RF4ENU4jb0FZFA/3do8", router.digest)
+ self.assertEquals("F260ABF1297B445E04354E236F4159140FF7768F", router.digest)
self.assertEquals(datetime.datetime(2012, 7, 12, 4, 1, 55), router.published)
self.assertEquals("178.218.213.229", router.address)
self.assertEquals(80, router.or_port)
@@ -339,7 +339,7 @@ TpQQk3nNQF8z6UIvdlvP+DnJV4izWVkQEZgUZgIVM0E=
router1 = document.routers[0]
self.assertEquals("moria2", router1.nickname)
self.assertEquals("719BE45DE224B607C53707D0E2143E2D423E74CF", router1.fingerprint)
- self.assertEquals("t/Pwl1uHiJ3RKF/Vehsbthf2VDI", router1.digest)
+ self.assertEquals("B7F3F0975B87889DD1285FD57A1B1BB617F65432", router1.digest)
self.assertEquals(datetime.datetime(2005, 12, 15, 6, 57, 18), router1.published)
self.assertEquals("18.244.0.114", router1.address)
self.assertEquals(443, router1.or_port)
@@ -349,7 +349,7 @@ TpQQk3nNQF8z6UIvdlvP+DnJV4izWVkQEZgUZgIVM0E=
router2 = document.routers[1]
self.assertEquals("stnv", router2.nickname)
self.assertEquals("0928BA467056C4A689FEE4EF5D71482B6289C3D5", router2.fingerprint)
- self.assertEquals("ItGn7UGZvaftbEFu7NdpwY4fKlo", router2.digest)
+ self.assertEquals("22D1A7ED4199BDA7ED6C416EECD769C18E1F2A5A", router2.digest)
self.assertEquals(datetime.datetime(2005, 12, 15, 16, 24, 42), router2.published)
self.assertEquals("84.16.236.173", router2.address)
self.assertEquals(9001, router2.or_port)
@@ -359,7 +359,7 @@ TpQQk3nNQF8z6UIvdlvP+DnJV4izWVkQEZgUZgIVM0E=
router3 = document.routers[2]
self.assertEquals("nggrplz", router3.nickname)
self.assertEquals("09E8582FF0E6F85E2B8E41C0DC0B9C9DC46E6968", router3.fingerprint)
- self.assertEquals("swLCsByU85jj7ziTlSawZR+CTdY", router3.digest)
+ self.assertEquals("B302C2B01C94F398E3EF38939526B0651F824DD6", router3.digest)
self.assertEquals(datetime.datetime(2005, 12, 15, 23, 25, 50), router3.published)
self.assertEquals("194.109.109.109", router3.address)
self.assertEquals(9001, router3.or_port)
@@ -379,7 +379,7 @@ TpQQk3nNQF8z6UIvdlvP+DnJV4izWVkQEZgUZgIVM0E=
router = next(descriptors)
self.assertEquals("sumkledi", router.nickname)
self.assertEquals("0013D22389CD50D0B784A3E4061CB31E8CE8CEB5", router.fingerprint)
- self.assertEquals("B5n4BiALAF8B5AqafxohyYiuj7E", router.digest)
+ self.assertEquals("0799F806200B005F01E40A9A7F1A21C988AE8FB1", router.digest)
self.assertEquals(datetime.datetime(2012, 7, 11, 4, 22, 53), router.published)
self.assertEquals("178.218.213.229", router.address)
self.assertEquals(80, router.or_port)
@@ -462,7 +462,7 @@ DnN5aFtYKiTc19qIC7Nmo+afPdDEf0MlJvEOP5EWl3w=
router = document.routers[0]
self.assertEquals("sumkledi", router.nickname)
self.assertEquals("0013D22389CD50D0B784A3E4061CB31E8CE8CEB5", router.fingerprint)
- self.assertEquals("B5n4BiALAF8B5AqafxohyYiuj7E", router.digest)
+ self.assertEquals("0799F806200B005F01E40A9A7F1A21C988AE8FB1", router.digest)
self.assertEquals(datetime.datetime(2012, 7, 11, 4, 22, 53), router.published)
self.assertEquals("178.218.213.229", router.address)
self.assertEquals(80, router.or_port)
diff --git a/test/unit/descriptor/router_status_entry.py b/test/unit/descriptor/router_status_entry.py
index b994f23..d01666b 100644
--- a/test/unit/descriptor/router_status_entry.py
+++ b/test/unit/descriptor/router_status_entry.py
@@ -50,7 +50,7 @@ class TestRouterStatusEntry(unittest.TestCase):
self.assertEqual(None, entry.document)
self.assertEqual("caerSidi", entry.nickname)
self.assertEqual("A7569A83B5706AB1B1A9CB52EFF7D2D32E4553EB", entry.fingerprint)
- self.assertEqual("oQZFLYe9e4A7bOkWKR7TaNxb0JE", entry.digest)
+ self.assertEqual("A106452D87BD7B803B6CE916291ED368DC5BD091", entry.digest)
self.assertEqual(datetime.datetime(2012, 8, 6, 11, 19, 31), entry.published)
self.assertEqual("71.35.150.29", entry.address)
self.assertEqual(9001, entry.or_port)
@@ -71,7 +71,7 @@ class TestRouterStatusEntry(unittest.TestCase):
self.assertEqual(None, entry.document)
self.assertEqual("caerSidi", entry.nickname)
self.assertEqual("A7569A83B5706AB1B1A9CB52EFF7D2D32E4553EB", entry.fingerprint)
- self.assertEqual("oQZFLYe9e4A7bOkWKR7TaNxb0JE", entry.digest)
+ self.assertEqual("A106452D87BD7B803B6CE916291ED368DC5BD091", entry.digest)
self.assertEqual(datetime.datetime(2012, 8, 6, 11, 19, 31), entry.published)
self.assertEqual("71.35.150.29", entry.address)
self.assertEqual(9001, entry.or_port)
More information about the tor-commits
mailing list