Skip to content

Commit

Permalink
cleanup of previous patch
Browse files Browse the repository at this point in the history
  • Loading branch information
LRGH committed Mar 17, 2017
1 parent 391fd6e commit 124b317
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
3 changes: 0 additions & 3 deletions crysp/bits.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ def __init__(self,v,size=None,bitorder=-1):
self.ival = (self.ival<<1)|(x&1)
elif isinstance(v,bytes):
self.load(v,bitorder)
elif isinstance(v,str):
# We are using python3, because 'str' and 'bytes' are different
self.load(v.encode(),bitorder)
else:
raise TypeError(v)
if size!=None: self.size = size
Expand Down
3 changes: 1 addition & 2 deletions crysp/crc.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ def crc(data,table,Xinit=0,Xfinal=None):
print("crc: bytes input required")
return None
r = Bits(Xinit,table[0].size)
data = struct.unpack("%dB"%len(data), data)
for b in data:
for b in struct.unpack("%dB"%len(data), data):
p = table[(r.ival^b)&0xff]
r = (r>>8)^p
if Xfinal:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_chacha.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ def test_chacha_002():
# -------------------------------------------------------------------

def tobits(s):
s = s.split()
x = struct.pack("%dB"%len(s), *[int(x,16) for x in s])
x = struct.pack("%dB"%len(s), *[int(x,16) for x in s.split()])
return Bits(x,bitorder=1)

def test_chacha_003():
Expand Down

0 comments on commit 124b317

Please sign in to comment.