summaryrefslogtreecommitdiff
path: root/rsa
diff options
context:
space:
mode:
authorYesudeep Mangalapilly <yesudeep@gmail.com>2011-08-12 13:12:06 +0530
committerYesudeep Mangalapilly <yesudeep@gmail.com>2011-08-12 13:12:06 +0530
commit3780830bae12d3f2f6f6145eb62727cadf734928 (patch)
tree24b40269222d279bd6d4041df140ce1ec1505c8d /rsa
parentb7341b658d6d2285676ce0b3c287383ad69a293e (diff)
downloadrsa-3780830bae12d3f2f6f6145eb62727cadf734928.tar.gz
Completes machine-aligned int2bytes implementation.
* This implementation is generally in microseconds instead of milliseconds, which makes it 20x-40x faster than the older implementation. Tests for all of the behavior of the function have been added to tests/test_transform.py. Hope this helps make python-rsa even better. =)
Diffstat (limited to 'rsa')
-rw-r--r--rsa/transform.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/rsa/transform.py b/rsa/transform.py
index 5318dbf..c0f458e 100644
--- a/rsa/transform.py
+++ b/rsa/transform.py
@@ -21,6 +21,15 @@ From bytes to a number, number to bytes, etc.
from __future__ import absolute_import
+try:
+ # We'll use psyco if available on 32-bit architectures to speed up code.
+ # Using psyco (if available) cuts down the execution time on Python 2.5
+ # at least by half.
+ import psyco
+ psyco.full()
+except ImportError:
+ pass
+
import binascii
from struct import pack
from rsa import common