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

Bytearray support #81

Open
wants to merge 15 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@mitchellrj
Copy link
Contributor

mitchellrj commented Apr 29, 2014

See https://bugs.launchpad.net/pycrypto/+bug/1256172

bytearray/bytes support was introduced in Python 2.6 and they were supported in hashlib functions from 2.7. This pull requests adds bytearray support for all hashing & cipher functions where previously strings or bytes had to be used for all Python versions from 2.6 onwards.

All tests including new ones pass on Python 2.4, 2.5, 2.6, 2.7, 3.1, 3.2, 3.3, 3.4 on Ubuntu 12.04.

I have been unable to test on 2.1, 2.2, 2.3, 3.0.

@Legrandin

This comment has been minimized.

Copy link
Contributor

Legrandin commented Apr 29, 2014

I would suggest to simplify the change set by assuming that it targets PyCrypto 2.7.

On the ML, Dwayne said that it would be the first version that drops support for anything older than python 2.6: in other words, you can assume that the buffer protocol is always available.
That would lead to much cleaner C files.

@mitchellrj

This comment has been minimized.

Copy link
Contributor

mitchellrj commented Apr 29, 2014

Ah, I didn't know that. That will indeed make the changes much cleaner.
I'll update the pull request shortly.

Thanks
On 29 Apr 2014 13:00, "Legrandin" notifications@github.com wrote:

I would suggest to simplify the change set by assuming that it targets
PyCrypto 2.7.

On the ML, Dwayne said that it would be the first version that drops
support for anything older than python 2.6: in other words, you can assume
that the buffer protocol is always available.
That would lead to much cleaner C files.


Reply to this email directly or view it on GitHubhttps://github.com//pull/81#issuecomment-41667256
.

@Legrandin

This comment has been minimized.

Copy link
Contributor

Legrandin commented Apr 29, 2014

BTW, what is the difference between this and #47 ?

@mitchellrj

This comment has been minimized.

Copy link
Contributor

mitchellrj commented Apr 29, 2014

I wasn't aware of that since it wasn't mentioned in the Launchpad ticket...

Anyway. Main differences are:

  • This pull request has tests
  • This pull request has the same behaviour for MD5 & SHA1 as for other hash
    algorithms under Python 2.6
  • This pull request doesn't break if bytearrays are passed to Galois or
    CMAC.
  • This pull request may need some work on Windows support, noting the
    changes to winrand.c in the other.

On 29 April 2014 13:13, Legrandin notifications@github.com wrote:

BTW, what is the difference between this and #47#47?


Reply to this email directly or view it on GitHubhttps://github.com//pull/81#issuecomment-41668252
.

@mitchellrj

This comment has been minimized.

Copy link
Contributor

mitchellrj commented Apr 29, 2014

On second thoughts, I think it'd be better to create a separate pull request for removal of Py < 2.6 support.

Otherwise, this pull request is complete as far as I'm concerned.

@mitchellrj

This comment has been minimized.

Copy link
Contributor

mitchellrj commented Apr 29, 2014

See #84 for removal of < Python 2.6 support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment