Fix use of mebibyte.

This commit is contained in:
voussoir 2022-12-02 17:36:50 -08:00
parent eb4c48cbca
commit 0a136250d9
3 changed files with 6 additions and 6 deletions

View file

@ -41,7 +41,7 @@ def decrypt_file(aes, input_handle, output_handle):
last_byte = chunk[-1]
while chunk and chunk[-1] == last_byte:
chunk = chunk[:-1]
if bytes_read % bytestring.MIBIBYTE == 0:
if bytes_read % bytestring.MEBIBYTE == 0:
print(bytestring.bytestring(bytes_read))
output_handle.write(chunk)
@ -59,7 +59,7 @@ def encrypt_file(aes, input_handle, output_handle):
chunk += pad_byte * (BLOCK_SIZE - len(chunk))
done = True
bytes_read += len(chunk)
if bytes_read % bytestring.MIBIBYTE == 0:
if bytes_read % bytestring.MEBIBYTE == 0:
print(bytestring.bytestring(bytes_read))
chunk = aes.encrypt(chunk)
output_handle.write(chunk)

View file

@ -10,7 +10,7 @@ from voussoirkit import bytestring
from voussoirkit import downloady
from voussoirkit import pipeable
DEFAULT_PIECE_SIZE = bytestring.MIBIBYTE
DEFAULT_PIECE_SIZE = bytestring.MEBIBYTE
DEFAULT_THREAD_COUNT = 10
def init(url, localname=None, piece_size=DEFAULT_PIECE_SIZE):

View file

@ -18,7 +18,7 @@ from voussoirkit import passwordy
from voussoirkit import pathclass
from voussoirkit import ratelimiter
CHUNK_SIZE = bytestring.MIBIBYTE
CHUNK_SIZE = bytestring.MEBIBYTE
OPENDIR_TEMPLATE = '''
<html>
@ -553,7 +553,7 @@ def main(argv):
'--overall_ratelimit',
'--overall-ratelimit',
type=bytestring.parsebytes,
default=200*bytestring.MIBIBYTE,
default=200*bytestring.MEBIBYTE,
help='''
The maximum bytes/sec of the server overall.
''',
@ -573,7 +573,7 @@ def main(argv):
'--individual_ratelimit',
'--individual-ratelimit',
type=bytestring.parsebytes,
default=100*bytestring.MIBIBYTE,
default=100*bytestring.MEBIBYTE,
help='''
The maximum bytes/sec for any single request.
''',