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

View file

@ -10,7 +10,7 @@ from voussoirkit import bytestring
from voussoirkit import downloady from voussoirkit import downloady
from voussoirkit import pipeable from voussoirkit import pipeable
DEFAULT_PIECE_SIZE = bytestring.MIBIBYTE DEFAULT_PIECE_SIZE = bytestring.MEBIBYTE
DEFAULT_THREAD_COUNT = 10 DEFAULT_THREAD_COUNT = 10
def init(url, localname=None, piece_size=DEFAULT_PIECE_SIZE): 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 pathclass
from voussoirkit import ratelimiter from voussoirkit import ratelimiter
CHUNK_SIZE = bytestring.MIBIBYTE CHUNK_SIZE = bytestring.MEBIBYTE
OPENDIR_TEMPLATE = ''' OPENDIR_TEMPLATE = '''
<html> <html>
@ -553,7 +553,7 @@ def main(argv):
'--overall_ratelimit', '--overall_ratelimit',
'--overall-ratelimit', '--overall-ratelimit',
type=bytestring.parsebytes, type=bytestring.parsebytes,
default=200*bytestring.MIBIBYTE, default=200*bytestring.MEBIBYTE,
help=''' help='''
The maximum bytes/sec of the server overall. The maximum bytes/sec of the server overall.
''', ''',
@ -573,7 +573,7 @@ def main(argv):
'--individual_ratelimit', '--individual_ratelimit',
'--individual-ratelimit', '--individual-ratelimit',
type=bytestring.parsebytes, type=bytestring.parsebytes,
default=100*bytestring.MIBIBYTE, default=100*bytestring.MEBIBYTE,
help=''' help='''
The maximum bytes/sec for any single request. The maximum bytes/sec for any single request.
''', ''',