Update Picocrypt.py
This commit is contained in:
parent
a37f9717e9
commit
51f2ca7609
|
@ -1008,13 +1008,12 @@ def work():
|
||||||
# Encrypt, etc.
|
# Encrypt, etc.
|
||||||
if mode=="encrypt":
|
if mode=="encrypt":
|
||||||
data = cipher.encrypt(piece)
|
data = cipher.encrypt(piece)
|
||||||
|
crc.update(data)
|
||||||
if reedsolo:
|
if reedsolo:
|
||||||
data = bytes(rs13.encode(data))
|
data = bytes(rs13.encode(data))
|
||||||
crc.update(data)
|
|
||||||
|
|
||||||
# Decrypt, etc.
|
# Decrypt, etc.
|
||||||
else:
|
else:
|
||||||
crc.update(piece)
|
|
||||||
if reedsolo:
|
if reedsolo:
|
||||||
try:
|
try:
|
||||||
data,_,fixed = rs13.decode(piece)
|
data,_,fixed = rs13.decode(piece)
|
||||||
|
@ -1035,7 +1034,6 @@ def work():
|
||||||
counter = 0
|
counter = 0
|
||||||
while True:
|
while True:
|
||||||
# Basically just strip off the Reed-Solomon bytes
|
# Basically just strip off the Reed-Solomon bytes
|
||||||
# and return the original non-encoded data
|
|
||||||
if counter<1104905:
|
if counter<1104905:
|
||||||
data += piece[counter:counter+242]
|
data += piece[counter:counter+242]
|
||||||
counter += 255 # 242 bytes + 13 Reed-Solomon
|
counter += 255 # 242 bytes + 13 Reed-Solomon
|
||||||
|
@ -1045,9 +1043,11 @@ def work():
|
||||||
reedsoloErrors += 1
|
reedsoloErrors += 1
|
||||||
|
|
||||||
reedsoloFixed += len(fixed)
|
reedsoloFixed += len(fixed)
|
||||||
|
crc.update(data)
|
||||||
data = cipher.decrypt(data)
|
data = cipher.decrypt(data)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
crc.update(piece)
|
||||||
data = cipher.decrypt(piece)
|
data = cipher.decrypt(piece)
|
||||||
|
|
||||||
# Write the data, increase the amount done
|
# Write the data, increase the amount done
|
||||||
|
@ -1130,7 +1130,7 @@ def work():
|
||||||
tmp = "s" if reedsoloFixed!=1 else ""
|
tmp = "s" if reedsoloFixed!=1 else ""
|
||||||
statusString.set(
|
statusString.set(
|
||||||
f"Completed with {reedsoloFixed} byte{tmp}"+
|
f"Completed with {reedsoloFixed} byte{tmp}"+
|
||||||
"fixed. (Click here to show output 🡪)"
|
" fixed. (Click here to show output 🡪)"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if kept=="modified":
|
if kept=="modified":
|
||||||
|
|
Loading…
Reference in New Issue