Skip to content
This repository has been archived by the owner on Feb 5, 2021. It is now read-only.

[Python] Index out of range on PMAC STREAM #189

Closed
PokeTheCiTy opened this issue Aug 21, 2018 · 1 comment
Closed

[Python] Index out of range on PMAC STREAM #189

PokeTheCiTy opened this issue Aug 21, 2018 · 1 comment

Comments

@PokeTheCiTy
Copy link

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

@tarcieri
Copy link
Contributor

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.

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

No branches or pull requests

2 participants