[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Drop _digest_for_bytes() helper



commit 5345118632c5446fa39d1f4b901c572b0f87067a
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Mon Mar 13 09:17:47 2017 -0700

    Drop _digest_for_bytes() helper
    
    Branch added this new helper but didn't end up using it, so might as well drop
    it.
---
 stem/descriptor/__init__.py | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/stem/descriptor/__init__.py b/stem/descriptor/__init__.py
index 97e7699..6e8c5a4 100644
--- a/stem/descriptor/__init__.py
+++ b/stem/descriptor/__init__.py
@@ -636,18 +636,7 @@ class Descriptor(object):
       raise ValueError("Digest is for the range ending with '%s' but that isn't in our descriptor" % end)
 
     digest_content = raw_descriptor[start_index:end_index + len(end)]
-    return self._digest_for_bytes(digest_content)
-
-  def _digest_for_bytes(self, bytes_to_sign):
-    """
-    Provides a digest of the provided bytes
-
-    :param bytes bytes_to_sign: the bytes for which we should generate a digest
-
-    :returns: the digest string encoded in uppercase hex
-    """
-
-    digest_hash = hashlib.sha1(bytes_to_sign)
+    digest_hash = hashlib.sha1(stem.util.str_tools._to_bytes(digest_content))
     return stem.util.str_tools._to_unicode(digest_hash.hexdigest().upper())
 
   def __getattr__(self, name):



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits