From 518c447fef64b1adb0387ff3a56d9c061e6e90d3 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 22 Aug 2018 12:47:40 -0300 Subject: [PATCH] standardize distance.py to int.from_bytes --- lbrynet/dht/distance.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lbrynet/dht/distance.py b/lbrynet/dht/distance.py index f07a1474a..2c1099535 100644 --- a/lbrynet/dht/distance.py +++ b/lbrynet/dht/distance.py @@ -1,5 +1,3 @@ -from binascii import hexlify - from lbrynet.dht import constants @@ -14,10 +12,10 @@ class Distance: if len(key) != constants.key_bits // 8: raise ValueError("invalid key length: %i" % len(key)) self.key = key - self.val_key_one = int(hexlify(key), 16) + self.val_key_one = int.from_bytes(key, 'big') def __call__(self, key_two): - val_key_two = int(hexlify(key_two), 16) + val_key_two = int.from_bytes(key_two, 'big') return self.val_key_one ^ val_key_two def is_closer(self, a, b):