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