pyaes
pyaes copied to clipboard
BlockFeeder has quadratic time complexity (O(n^2))
Line 181 slices the front off the buffer, to keep track of what's remaining:
https://github.com/ricmoo/pyaes/blob/23a1b4c0488bd38e03a48120dfda98913f4c87d2/pyaes/blockfeeder.py#L181
This operation is O(n), since the python runtime must make a new copy of the data. Since this repeats O(n) times, the overall complexity is O(n^2). This gets particularly noticeable for larger inputs (>1MB).
I suggest either using an io.BytesIO
object, or simply keeping track of an index into the buffer.