aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2014-08-20 21:29:45 +0000
committerMicah Lee <micah@micahflee.com>2014-08-20 21:29:45 +0000
commit2ac25e2995839b8bd45b5259feabf5dc365b8f23 (patch)
treebe148c5049d459b4a140d5f2e3b277a6fa00863e
parentbda5bc3450d0f001dc8aef514295b59e251c327b (diff)
downloadonionshare-2ac25e2995839b8bd45b5259feabf5dc365b8f23.tar.gz
onionshare-2ac25e2995839b8bd45b5259feabf5dc365b8f23.zip
import appropriate modules for constant_time_compare to work
-rw-r--r--onionshare/onionshare.py4
-rw-r--r--setup/onionshare-launcher.py5
2 files changed, 6 insertions, 3 deletions
diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py
index 6ca1eebc..5f0fe35a 100644
--- a/onionshare/onionshare.py
+++ b/onionshare/onionshare.py
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
-import os, sys, subprocess, time, hashlib, platform, json, locale, socket, argparse, Queue, inspect, base64, mimetypes
+import os, sys, subprocess, time, hashlib, platform, json, locale, socket, argparse, Queue, inspect, base64, mimetypes, hmac
from random import randint
from functools import wraps
+from itertools import izip
from stem.control import Controller
from stem import SocketError
@@ -14,6 +15,7 @@ def constant_time_compare(val1, val2):
_builtin_constant_time_compare = getattr(hmac, 'compare_digest', None)
if _builtin_constant_time_compare is not None:
return _builtin_constant_time_compare(val1, val2)
+
len_eq = len(val1) == len(val2)
if len_eq:
result = 0
diff --git a/setup/onionshare-launcher.py b/setup/onionshare-launcher.py
index 09c0343e..83bf628b 100644
--- a/setup/onionshare-launcher.py
+++ b/setup/onionshare-launcher.py
@@ -1,6 +1,7 @@
from __future__ import division
-import os, sys, subprocess, time, hashlib, platform, json, locale, socket, argparse, Queue, inspect, base64, random, functools, logging, ctypes
-import stem, stem.control, flask, itsdangerous
+import os, sys, subprocess, time, hashlib, platform, json, locale, socket, argparse, Queue, inspect, base64, random, functools, logging, ctypes, hmac
+from itertools import izip
+import stem, stem.control, flask
from PyQt4 import QtCore, QtGui
import onionshare, onionshare_gui