Skip to content

Commit 8374df2

Browse files
committed
cleanup of previous patch
1 parent 391fd6e commit 8374df2

3 files changed

Lines changed: 2 additions & 7 deletions

File tree

crysp/bits.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ def __init__(self,v,size=None,bitorder=-1):
9494
self.ival = (self.ival<<1)|(x&1)
9595
elif isinstance(v,bytes):
9696
self.load(v,bitorder)
97-
elif isinstance(v,str):
98-
# We are using python3, because 'str' and 'bytes' are different
99-
self.load(v.encode(),bitorder)
10097
else:
10198
raise TypeError(v)
10299
if size!=None: self.size = size

crysp/crc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ def crc(data,table,Xinit=0,Xfinal=None):
4545
print("crc: bytes input required")
4646
return None
4747
r = Bits(Xinit,table[0].size)
48-
data = struct.unpack("%dB"%len(data), data)
49-
for b in data:
48+
for b in struct.unpack("%dB"%len(data), data):
5049
p = table[(r.ival^b)&0xff]
5150
r = (r>>8)^p
5251
if Xfinal:

tests/test_chacha.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ def test_chacha_002():
8787
# -------------------------------------------------------------------
8888

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

9493
def test_chacha_003():

0 commit comments

Comments
 (0)