solved python 2.6 issue

This commit is contained in:
deezerdl 2017-05-26 15:48:13 +00:00 committed by GitHub
parent f69a9cb60a
commit 0e41f9aae2

View File

@ -1,6 +1,6 @@
from __future__ import unicode_literals
import struct
from compat import compat_struct_unpack, compat_struct_pack
# Blowfish implementation, translated from original C code by Bruce Schneier.
@ -292,9 +292,9 @@ def blowfish_cbc_decrypt(data, key, iv):
"""
fmt = ">%dL" % (len(data) // 4)
c = Blowfish(key)
ivl, ivr = struct.unpack(">LL", iv)
ivl, ivr = compat_struct_unpack(">LL", iv)
out = []
ind = struct.unpack(fmt, data)
ind = compat_struct_unpack(fmt, data)
for i in range(0, len(ind), 2):
l, r = c.decipher(ind[i], ind[i + 1])
@ -305,7 +305,7 @@ def blowfish_cbc_decrypt(data, key, iv):
out.append(l)
out.append(r)
return struct.pack(fmt, *out)
return compat_struct_pack(fmt, *out)
__all__ = ['blowfish_cbc_decrypt']