Skip to content

Commit

Permalink
Fix little-endian byte-order input encryption and decryption.
Browse files Browse the repository at this point in the history
This fixes bug <#9>.

`u4_1_struct` is used to split 32-bit integers into 4 bytes. The higher 8 bits
should be the first byte, the next 8 bits should be the next byte, and so on.
So, it should always be in big-endian byte order and not be dependent on the
`byte_order` option.
  • Loading branch information
jashandeep-sohi committed Feb 28, 2015
1 parent 273a29c commit 9d307c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions blowfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from struct import Struct, error as struct_error
from itertools import cycle as iter_cycle

__version__ = "0.6.0"
__version__ = "0.6.1"

# PI_P_ARRAY & PI_S_BOXES are the hexadecimal digits of π (the irrational)
# taken from <https://www.schneier.com/code/constants.txt>.
Expand Down Expand Up @@ -330,7 +330,7 @@ def __init__(

# Create structs
u4_2_struct = Struct("{}2I".format(byte_order_fmt))
u4_1_struct = Struct("{}I".format(byte_order_fmt))
u4_1_struct = Struct(">I".format(byte_order_fmt))
u8_1_struct = Struct("{}Q".format(byte_order_fmt))
u1_4_struct = Struct("=4B")

Expand Down

0 comments on commit 9d307c7

Please sign in to comment.