Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AESModeOfOperationCTR always uses 16 bytes counters? #31

Open
cristianocca opened this issue Oct 9, 2020 · 1 comment
Open

AESModeOfOperationCTR always uses 16 bytes counters? #31

cristianocca opened this issue Oct 9, 2020 · 1 comment

Comments

@cristianocca
Copy link

aes = pyaes.AESModeOfOperationCTR(self.KEY, counter=pyaes.Counter(initial_value=iv))
print(len(aes._counter.value))

The counter value length seems to always be 16 regardless of if the key is 16 or 32 bytes. Is this the right behaviour? Or would this mean a security risk when using 32 bytes (256 bits) keys?

@cristianocca
Copy link
Author

cristianocca commented Oct 9, 2020

https://github.com/ricmoo/pyaes/blob/master/pyaes/aes.py#L281

The 128 should probably 256 when using 32 bytes keys.

Or not, the block size seems to always be 16 bytes regardless of the key size, so perhaps the function docs are wrong The counter must be the same size as the key size (ie. len(key)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant