[tor-commits] [pyonionoo/master] Search hashed fingerprint also
karsten at torproject.org
karsten at torproject.org
Thu Sep 27 00:24:34 UTC 2012
commit 312d6fbd6b44c3581b6b13aac242c3ff3abe56bd
Author: Sathyanarayanan Gunasekaran <gsathya.ceg at gmail.com>
Date: Tue Sep 25 19:28:57 2012 +0530
Search hashed fingerprint also
---
pyonionoo/parser.py | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/pyonionoo/parser.py b/pyonionoo/parser.py
index 4cfdd11..f82ec2e 100644
--- a/pyonionoo/parser.py
+++ b/pyonionoo/parser.py
@@ -1,10 +1,14 @@
import re
import datetime
+from binascii import a2b_hex
+from hashlib import sha1
+
class Router:
def __init__(self):
self.nickname = None
self.fingerprint = None
+ self.hex_fingerprint = None
self.address = None
self.addresses = None
self.exit_addresses = None
@@ -30,6 +34,7 @@ class Router:
self.nickname = values[1]
self.fingerprint = values[2]
+ self.hex_fingerprint = sha1(a2b_hex(self.fingerprint)).hexdigest()
if ';' in values[3]:
address_parts = values[3].split(';')
@@ -82,8 +87,8 @@ class Router:
router_list = []
for field in fields:
if field == "search":
- value = ' %s %s %s' % (self.fingerprint, self.nickname,
- self.address)
+ value = ' %s %s %s %s' % (self.fingerprint, self.hex_fingerprint,
+ self.nickname, self.address)
elif field == "flags":
value = ' '.join(self.flags)
# add leading space
More information about the tor-commits
mailing list