solved python 2.6 issue
This commit is contained in:
parent
f69a9cb60a
commit
0e41f9aae2
@ -1,6 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
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.
|
# 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)
|
fmt = ">%dL" % (len(data) // 4)
|
||||||
c = Blowfish(key)
|
c = Blowfish(key)
|
||||||
ivl, ivr = struct.unpack(">LL", iv)
|
ivl, ivr = compat_struct_unpack(">LL", iv)
|
||||||
out = []
|
out = []
|
||||||
ind = struct.unpack(fmt, data)
|
ind = compat_struct_unpack(fmt, data)
|
||||||
|
|
||||||
for i in range(0, len(ind), 2):
|
for i in range(0, len(ind), 2):
|
||||||
l, r = c.decipher(ind[i], ind[i + 1])
|
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(l)
|
||||||
out.append(r)
|
out.append(r)
|
||||||
|
|
||||||
return struct.pack(fmt, *out)
|
return compat_struct_pack(fmt, *out)
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['blowfish_cbc_decrypt']
|
__all__ = ['blowfish_cbc_decrypt']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user