[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [trunnel/master] Repair integer encoding :(
commit 6d7892932e01fa35b091d08961d7a7c1baab7407
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Thu Dec 29 23:13:06 2016 -0500
Repair integer encoding :(
---
lib/trunnel/SeedFuzzer.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/trunnel/SeedFuzzer.py b/lib/trunnel/SeedFuzzer.py
index 369eb88..9726c3a 100644
--- a/lib/trunnel/SeedFuzzer.py
+++ b/lib/trunnel/SeedFuzzer.py
@@ -193,8 +193,12 @@ class NamedInt(object):
# didn't. How about 3? 3 is a nice number.
val = 3
# encode val little-endian in width bytes.
- return b"".join(chr((val >> (self._width-i)) & 0xff)
- for i in xrange(1, self._width+1))
+ return encodeInt(val, self._width)
+
+
+def encodeInt(val, width):
+ return b"".join(chr((val >> (width-i)*8) & 0xff)
+ for i in xrange(1, width+1))
def findLength(lst):
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits