From de6e869a7981d49725e791303bd16c4159d70880 Mon Sep 17 00:00:00 2001 From: Gifts Date: Wed, 1 Feb 2017 16:55:15 +0300 Subject: [PATCH] Fix for RandomChallenge function. Function getrandbits can return less than 64 bits, thus decode('hex') will crash with TypeError: Odd-length string --- utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.py b/utils.py index 4c6db50..dea8463 100644 --- a/utils.py +++ b/utils.py @@ -26,7 +26,7 @@ import datetime def RandomChallenge(): if settings.Config.NumChal == "random": from random import getrandbits - NumChal = '%0x' % getrandbits(16 * 4) + NumChal = '%016x' % getrandbits(16 * 4) Challenge = '' for i in range(0, len(NumChal),2): Challenge += NumChal[i:i+2].decode("hex")