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

Null bytes in the 'secret' cause a ValueError #11

mklopot opened this issue Jun 20, 2019 · 1 comment


None yet
2 participants
Copy link

commented Jun 20, 2019

When hex data is passed into the secret, embedded null bytes cause a failure with a ValueError.

To reproduce: gfshare.split(3,5,b"hello\x00world")

Excluding null bytes from randomized hex input reduces the key space significantly, for example, for a 32 byte value the key space is reduced by over 12%.

The underlying libgfshare.h C library appears to handle null bytes without a problem. The issue here begins on line 177 of gfshare.c, where PyArg_ParseTupleAndKeywords() is using a 'y' in the format string, this results in rejecting null bytes from that parameter:

The solution would be to use s* format and change the underlying data structure to a Py_buffer, or to use s#...

@lamby lamby closed this in 0d16dc0 Jun 22, 2019


This comment has been minimized.

Copy link

commented Jun 22, 2019

Thanks for this, released in 1.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.