From f8afd8b5ce59fa4aeb8bf6b20a1b211a84073441 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 26 Mar 2015 16:13:35 -0400 Subject: [PATCH] Make sure to parse the big int into a byte string --- data/users.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/users.py b/data/users.py index 628f5a0c3..13556a552 100644 --- a/data/users.py +++ b/data/users.py @@ -3,6 +3,7 @@ import logging import json import itertools import uuid +import struct from util.aes import AESCipher from util.validation import generate_valid_usernames @@ -150,7 +151,8 @@ class UserAuthentication(object): # First try parsing the key as an int. try: - secret_key = int(app_secret_key) + big_int = int(app_secret_key) + secret_key = bytearray.fromhex('{:02x}'.format(big_int)) except ValueError: secret_key = app_secret_key