[tor-commits] [bridgedb/master] Deepcopy the HMAC factory function's resulting function.

isis at torproject.org isis at torproject.org
Sun Jan 12 06:06:32 UTC 2014


commit a49ee2a0872b474e11a5f8dd9c169b2fac1ae22e
Author: Isis Lovecruft <isis at torproject.org>
Date:   Fri Nov 15 15:29:38 2013 +0000

    Deepcopy the HMAC factory function's resulting function.
---
 lib/bridgedb/Bridges.py |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/bridgedb/Bridges.py b/lib/bridgedb/Bridges.py
index 723d3c9..e8ca1d9 100644
--- a/lib/bridgedb/Bridges.py
+++ b/lib/bridgedb/Bridges.py
@@ -7,6 +7,7 @@ them in rings.
 
 import binascii
 import bisect
+import copy
 import hmac
 import logging
 import re
@@ -79,7 +80,7 @@ def get_hmac_fn(k, hex=True):
        If 'hex' is true, the output of the function will be hex-encoded."""
     h = hmac.new(k, digestmod=DIGESTMOD)
     def hmac_fn(v):
-        h_tmp = h.copy()
+        h_tmp = copy.deepcopy(h)
         h_tmp.update(v)
         if hex:
             return h_tmp.hexdigest()





More information about the tor-commits mailing list