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

[tor-commits] [stem/master] Add hash_type and encoding arguments to descriptor digest() methods



commit 5d3565002b954ca49e1bc45d6dc68e1c99716069
Merge: 0a8b47e8 6beaaf49
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Thu Nov 15 12:18:03 2018 -0800

    Add hash_type and encoding arguments to descriptor digest() methods
    
    Iain made a great point that it's tougher to calculate descriptor digests than
    it should be...
    
      https://trac.torproject.org/projects/tor/ticket/28398
    
    Digest type and encoding varies by their use. Mostly our spec sticks with
    sha1/hex or sha256/base64, but sometimes it differs. For instance, the consensus
    cites sha1/base64 server desciptor digests, whereas according to Karsten Tor
    Metrics uses sha1/hex digests for filenames.
    
    Presently server and extrainfo descriptors are the only classes with digest()
    methods. Microdescriptors should (consensus votes cite microdescriptor digests)
    but nobody has asked for those so we'll cross that bridge when we come to it.
    
    This branch expands our digest() methods in the following ways...
    
      * Add a hash_type argument so callers can specify sha1 or sha256
        hashing.
    
      * Add an encoding argument so callers can specify hex, base64, or
        no encoding.
    
      * In our digest documentation cite what references that descriptor
        type's digest (ie. 'what the heck is this useful for?').

 docs/change_log.rst                          |  1 +
 stem/descriptor/__init__.py                  | 91 ++++++++++++++++++++++------
 stem/descriptor/extrainfo_descriptor.py      | 55 +++++++++++++----
 stem/descriptor/hidden_service_descriptor.py |  3 +-
 stem/descriptor/networkstatus.py             |  4 +-
 stem/descriptor/server_descriptor.py         | 38 +++++++++---
 test/unit/descriptor/extrainfo_descriptor.py |  3 +-
 test/unit/descriptor/server_descriptor.py    |  1 +
 8 files changed, 155 insertions(+), 41 deletions(-)

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