[Python] Index out of range on PMAC STREAM
PokeTheCiTy opened this issue · comments
Hi,
I may miss something on the usage of Encryptor with PMAC but I got a IndexError: list index out of range
when I try to seal something big enough with it.
How to reproduce
import os
from miscreant.stream import Encryptor
nonce = os.urandom(8)
key = os.urandom(12)
encryptor = Encryptor('AES-PMAC-SIV', key, nonce)
with open('a_file', 'rb') as le_file:
encryptor.seal(le_file.read())
I got no issue by replacing 'AES-PMAC-SIV' by 'AES-SIV'
It started to have an error with a file of 5Ko
Am I misusing PMAC algo ? Since I read it had better performance than AES-SIV, I would prefer using it as I use STREAM to encrypt large file.
Thank you
Dupe of #170.
This is a known bug in the CTZ implementation. We need to switch to using De Bruijn sequences to calculate CTZ, unless there happens to be a native CTZ for Python I'm unaware of.