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

Re: [tor-bugs] #9988 [BridgeDB]: Refactor BridgeDB's use of `sha` module to use `hashlib` instead.



#9988: Refactor BridgeDB's use of `sha` module to use `hashlib` instead.
--------------------------+----------------------
     Reporter:  isis      |      Owner:  isis
         Type:  defect    |     Status:  new
     Priority:  trivial   |  Milestone:
    Component:  BridgeDB  |    Version:
   Resolution:            |   Keywords:  bridgedb
Actual Points:            |  Parent ID:
       Points:            |
--------------------------+----------------------

Comment (by sysrqb):

 Hi ovnicraft!

 Awesome, thanks for the patches! The two comments I have on them are that:
 1) the new() constructor should take the algorithm as a parameter
 {{{
     new = __hash_new(name, string='')
         new(name, string='') - Return a new hashing object
                                using the named algorithm;
                                optionally initialized with
                                a string.
 }}}
 2) According to the docs, using new() is a bit slower than using the
 algorithm specific constructors.

 {{{
 A generic new() constructor that takes the string name of the desired
 algorithm as its first parameter also exists to allow access to the
 above listed hashes as well as any other algorithms that your OpenSSL
 library may offer. The named constructors are much faster than new() and
 should be preferred.
 }}}

 [0] http://docs.python.org/2/library/hashlib.html

 In the first patch you used hashlib.sha1 but in the second patch you used
 hashlib.new, was there a reason for this?

 Thanks again

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9988#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs