Skip to content

Improve conversion of Python integers to Big Numbers in EC module#211

Merged
jakinyele merged 1 commit intoJHUISI:devfrom
davidstritzl:feature/improve_ec_bignum_conversion
Aug 20, 2019
Merged

Improve conversion of Python integers to Big Numbers in EC module#211
jakinyele merged 1 commit intoJHUISI:devfrom
davidstritzl:feature/improve_ec_bignum_conversion

Conversation

@davidstritzl
Copy link
Copy Markdown
Contributor

This commit removes the conversion to MPZ integers when converting a Python long object to an OpenSSL bignum. For the intermediate conversion to a decimal string representation, Python internal functions are used here, however this is arguably less prone to breakage due to potential upcoming CPython changes than accessing internal fields as in the current code. This commit fixes an issue where for instance group.init(-1) == group.init(1) or g == -1 * g for some group element g. As for performance, on my local machine using Python 3.7, this reduces the time spent on group.init(...) by more than half; on Python 2.7 I see no significant change.

@timothymctim
Copy link
Copy Markdown
Contributor

Any progress on merging this patch so far? It fixes several bugs and also gives a speedup of the Python code “for free.”

@jakinyele
Copy link
Copy Markdown
Member

Apologies for the delay. Wanted to review/test to verify there were no unintended breaking changes and dropped the ball on testing. Anyway, merging now.

@jakinyele jakinyele merged commit 3214d1d into JHUISI:dev Aug 20, 2019
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

Successfully merging this pull request may close these issues.

3 participants