Giter VIP home page Giter VIP logo

pycrypto's Introduction

โš ๏ธ WARNING
PyCrypto 2.x is unmaintained, obsolete, and contains security vulnerabilities.
See https://www.pycrypto.org/ for details. The following is provided for historical/reference purposes only.

Python Cryptography Toolkit (pycrypto)

This is a collection of both secure hash functions (such as SHA256 and RIPEMD160), and various encryption algorithms (AES, DES, RSA, ElGamal, etc.). The package is structured to make adding new modules easy. This section is essentially complete, and the software interface will almost certainly not change in an incompatible way in the future; all that remains to be done is to fix any bugs that show up. If you encounter a bug, please report it in the GitHub issue tracker at https://github.com/dlitz/pycrypto/issues

An example usage of the SHA256 module is:

>>> from Crypto.Hash import SHA256
>>> hash = SHA256.new()
>>> hash.update('message')
>>> hash.digest()
'\xabS\n\x13\xe4Y\x14\x98+y\xf9\xb7\xe3\xfb\xa9\x94\xcf\xd1\xf3\xfb"\xf7\x1c\xea\x1a\xfb\xf0+F\x0cm\x1d'

An example usage of an encryption algorithm (AES, in this case) is:

>>> from Crypto.Cipher import AES
>>> obj = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456')
>>> message = "The answer is no"
>>> ciphertext = obj.encrypt(message)
>>> ciphertext
'\xd6\x83\x8dd!VT\x92\xaa`A\x05\xe0\x9b\x8b\xf1'
>>> obj2 = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456')
>>> obj2.decrypt(ciphertext)
'The answer is no'

One possible application of the modules is writing secure administration tools. Another application is in writing daemons and servers. Clients and servers can encrypt the data being exchanged and mutually authenticate themselves; daemons can encrypt private data for added security. Python also provides a pleasant framework for prototyping and experimentation with cryptographic algorithms; thanks to its arbitrary-length integers, public key algorithms are easily implemented.

As of PyCrypto 2.1.0, PyCrypto provides an easy-to-use random number generator:

>>> from Crypto import Random
>>> rndfile = Random.new()
>>> rndfile.read(16)
'\xf7.\x838{\x85\xa0\xd3>#}\xc6\xc2jJU'

A stronger version of Python's standard "random" module is also provided:

>>> from Crypto.Random import random
>>> random.choice(['dogs', 'cats', 'bears'])
'bears'

Caveat: For the random number generator to work correctly, you must call Random.atfork() in both the parent and child processes after using os.fork()

Installation

PyCrypto is written and tested using Python version 2.1 through 3.3. Python 1.5.2 is not supported.

The modules are packaged using the Distutils, so you can simply run python setup.py build to build the package, and "python setup.py install" to install it.

Linux installation requires the Python developer tools to be installed. These can be found in the python-dev package on Debian/Ubuntu and the python2-devel package on Red Hat/Fedora. If you are using a non-standard Python version for your distribution, you may require a different package. Consult your package manager's documentation for instructions on how to install these packages. Other distributions may have different package names.

To verify that everything is in order, run python setup.py test. It will test all the cryptographic modules, skipping ones that aren't available. If the test script reports an error on your machine, please report the bug using the bug tracker (URL given above). If possible, track down the bug and include a patch that fixes it, provided that you are able to meet the eligibility requirements at https://www.pycrypto.org/submission-requirements/.

It is possible to test a single sub-package or a single module only, for instance when you investigate why certain tests fail and don't want to run the whole suite each time. Use python setup.py test --module=name, where 'name' is either a sub-package (Cipher, PublicKey, etc) or a module (Cipher.DES, PublicKey.RSA, etc). To further cut test coverage, pass also the option --skip-slow-tests.

To install the package under the site-packages directory of your Python installation, run python setup.py install.

If you have any comments, corrections, or improvements for this package, please report them to our mailing list, accessible via the PyCrypto website:

https://www.pycrypto.org/
https://www.dlitz.net/software/pycrypto/

pycrypto's People

Contributors

4zm avatar akuchling avatar alsaan avatar aried3r avatar dev-jjc avatar dlitz avatar donlorenzo avatar fx5 avatar hsmtkk avatar jaraco avatar legrandin avatar mitchellrj avatar msabramo avatar oxc avatar paxan avatar rfk avatar sebastinas avatar stefanor avatar takluyver avatar thorsteneb avatar wbolster avatar windwiny avatar wking avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pycrypto's Issues

python3 setup.py test - Returned a Failure

python3 setup.py test - Returned a Failure:

Platform Ubuntu 14.04LTS in VirtualBox, running Python-3.4.2.
Here is what was reported (btw I am new to Python):-
simon@ubuntu-14:$ cd pycrypto-2.6.1/
simon@ubuntu-14:
/pycrypto-2.6.1$ python3 setup.py test
running test
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................SelfTest: You can ignore the RandomPool_DeprecationWarning that follows.

..........E...................

ERROR: test_negative_number_roundtrip_mpzToLongObj_longObjToMPZ (Crypto.SelfTest.Util.test_number.MiscTests)

Test that mpzToLongObj and longObjToMPZ (internal functions) roundtrip negative numbers correctly.

Traceback (most recent call last):
File "build/lib.linux-x86_64-3.4/Crypto/SelfTest/Util/test_number.py", line 283, in test_negative_number_roundtrip_mpzToLongObj_longObjToMPZ
k = number._fastmath.rsa_construct(n, e)
AttributeError: 'NoneType' object has no attribute 'rsa_construct'


Ran 1033 tests in 29.722s

FAILED (errors=1)
Traceback (most recent call last):
File "setup.py", line 456, in
core.setup(**kw)
File "/usr/local/lib/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/lib/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/local/lib/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "setup.py", line 336, in run
SelfTest.run(module=moduleObj, verbosity=self.verbose, stream=sys.stdout, config=self.config)
File "build/lib.linux-x86_64-3.4/Crypto/SelfTest/init.py", line 74, in run
raise SelfTestError("Self-test failed", result)
Crypto.SelfTest.SelfTestError: ('Self-test failed', <unittest.runner.TextTestResult run=1033 errors=1 failures=0>)
simon@ubuntu-14:~/pycrypto-2.6.1$

pycrypto 2.7a1 missing Crypto.Hash SHA256

I manually included the library component of the pycrypto 2.7a1 into my project and now it is missing the SHA256 has. Looking in the directory and .py files there is no SHA256. Here is the stack trace from PyCharm in building this.

Traceback (most recent call last):
File "/Users/mindninja/Documents/Working/labs/projects/python/auth-restler/restler.py", line 8, in
from Crypto.PublicKey import RSA
File "/Users/mindninja/Documents/Working/labs/projects/python/auth-restler/Crypto/PublicKey/RSA.py", line 79, in
from Crypto.IO import PKCS8, PEM
File "/Users/mindninja/Documents/Working/labs/projects/python/auth-restler/Crypto/IO/PKCS8.py", line 57, in
from Crypto.IO._PBES import PBES1, PBES2
File "/Users/mindninja/Documents/Working/labs/projects/python/auth-restler/Crypto/IO/_PBES.py", line 27, in
from Crypto import Random
File "/Users/mindninja/Documents/Working/labs/projects/python/auth-restler/Crypto/Random/init.py", line 29, in
from Crypto.Random import _UserFriendlyRNG
File "/Users/mindninja/Documents/Working/labs/projects/python/auth-restler/Crypto/Random/_UserFriendlyRNG.py", line 38, in
from Crypto.Random.Fortuna import FortunaAccumulator
File "/Users/mindninja/Documents/Working/labs/projects/python/auth-restler/Crypto/Random/Fortuna/FortunaAccumulator.py", line 37, in
import SHAd256
File "/Users/mindninja/Documents/Working/labs/projects/python/auth-restler/Crypto/Random/Fortuna/SHAd256.py", line 41, in
from Crypto.Hash import SHA256
ImportError: cannot import name SHA256

pycrypto 2.17a1 build issue on Mac OSx Yosemite

python setup.py test
running test
running build
running build_py
running build_ext
running build_configure
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Cipher._AESNI' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/usr/local/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/AESNI.c -o build/temp.macosx-10.10-x86_64-2.7/src/AESNI.o -maes
src/AESNI.c:51:16: error: index for __builtin_shufflevector must be a constant
integer
keygened = _mm_shuffle_epi32(keygened, shuf);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/include/emmintrin.h:1290:12: note:
expanded from macro '_mm_shuffle_epi32'
(__m128i)__builtin_shufflevector((__v4si)__a, (__v4si) _mm_set1_epi32(0),
^
src/AESNI.c:51:14: error: assigning to '__m128i'
(vector of 2 'long long' values) from incompatible type 'void'
keygened = _mm_shuffle_epi32(keygened, shuf);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/AESNI.c:225:
src/block_template.c:779:79: warning: comparison of constant 0 with boolean
expression is always false [-Wtautological-constant-out-of-range-compare]
...== NULL || PyType_Check((PyObject *)PCT_CounterBEType) < 0 ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
src/block_template.c:780:77: warning: comparison of constant 0 with boolean
expression is always false [-Wtautological-constant-out-of-range-compare]
...== NULL || PyType_Check((PyObject *)PCT_CounterLEType) < 0 ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
src/block_template.c:781:47: warning: comparison of constant 0 with boolean
expression is always false [-Wtautological-constant-out-of-range-compare]
abiver == NULL || PyInt_CheckExact(abiver) < 0 || PyInt...
~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
3 warnings and 2 errors generated.
error: command 'gcc' failed with exit status 1

Build fails if 'configure' is elsewhere in your path

The build fails with the following:

configure: error: cannot find sources (src/pycrypto_compat.h) in /Users/benno/local/src/wine-master or ..
Traceback (most recent call last):
  File "setup.py", line 510, in <module>
    core.setup(**kw)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/command/build.py", line 126, in run
    self.run_command(cmd_name)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "setup.py", line 256, in run
    self.run_command(cmd_name)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "setup.py", line 315, in run
    raise RuntimeError("autoconf error")
RuntimeError: autoconf error

If you happen to have a file called configure elsewhere in your path.

Calling "./configure" and then doing the build is one workaround. (As is removing the other directory from your path that happens to have configure in it).

The problematic code is in the configure script itself:

# IFS
# We need space, tab and new line, in precisely that order.  Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" ""    $as_nl"

# Find who we are.  Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
  *[\\/]* ) as_myself=$0 ;;
  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
  done
IFS=$as_save_IFS

     ;;
esac

If $0 (i.e.: the current executable) doesn't have a / or ** in it, then it searches the path until it finds a directory that does have configure in it. Unfortunately that is just a plain wrong approach to determining the location of the current executable.

I'm sure this code is inherited from autoconf somewhere, so the problem is probably way upstream, and there is little incentive to fix it. Changing the code in setup.py to "sh ./configure" fixes this problem, but may break on windows(?).

TypeError Exporting OpenSSH Public Key

Python 3.3.3 (default, Jan  5 2015, 10:54:38) 
[GCC 4.9.2 20141101 (Red Hat 4.9.2-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from Crypto.PublicKey import RSA
>>> key = RSA.generate(2048)
>>> key.exportKey('PEM')
b'-----BEGIN RSA PRIVATE KEY-----\nMIIEpQIBAAKCAQEA7txGVayF9uXBm422uybmRVOnwM9bEOR/ifEWMp35o0Rijb3C\nQQENDU9xY
...
ZrlmC0TAzwBwxEUeZP/R1b5xl6E7pfCAWJPQ=\n-----END RSA PRIVATE KEY-----'
>>> pubkey = key.publickey()
>>> pubkey.exportKey('OpenSSH')    
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dnelson/projects/htt-api/venv/lib/python3.3/site-packages/Crypto/PublicKey/RSA.py", line 352, in exportKey
    keystring = ''.join([ struct.pack(">I",len(kp))+kp for kp in keyparts]) 
  File "/home/dnelson/projects/htt-api/venv/lib/python3.3/site-packages/Crypto/PublicKey/RSA.py", line 352, in <listcomp>
    keystring = ''.join([ struct.pack(">I",len(kp))+kp for kp in keyparts]) 
TypeError: can't concat bytes to str
>>>

Looks like a Python 3 issue to me.

import name error

In the README document, it indicates

from Crypto.Cipher import AES
, which cannot work with error info 'ImportError: No module named 'Crypto''.

It should be

from crypto.Cipher import AES
. Import in Python is case-sensitive. I am not sure if it is related to my OS or python version.

My environment is Windows 10 64bit, and Python 3.4

pycrypto 2.6 doesn't public key encrypt properly

I am using the latest stable version of pycrypto (2.6). I am finding that when I conduct a public key encryption that the result is not decryptable on the other end. The public key is produced using OpenSSL encryption, which I have read could be an issue in 2.6. Right now I can't get it to work any way I try. There is an example I have used based on JSEncrypt that works, so I am sure the key is valid.

The allow_wraparound flag in lib/Crypto/Util/Counter.py is non-sense

Dear pyCrypto developpers,

I can't figure out any useful situation where the allow_wraparound flag defined in lib/Crypto/Util/Counter.py would be useful in practice. Instead, allowing the counter to wrap in the CTR mode can open a serious security issue (one can XOR the portions of the ciphertext generated with the same counter values, and one immediately gets the XOR of the corresponding parts of the plaintexts, which is a serious problem for non-random plaintexts).

If you split the CTR initial value into a nonce and a random initial counter value, and that you get exceptions because of the counter wrapping around, then it is because your counter has probably a too small bit width for your application. With a proper counter size, this situation should only happen with a probability that is negligible in practice.

I have quickly searched on Github examples where allow_wraparound would be set to True, and found none.

In summary, this option, introduced in 2.1.0alpha2, can IMHO only help developers to write bad crypto code, and it should be removed.

Build seems to be broken on Windows due to tomcrypt_cipher.h

When I run python setup.py build from the current master, which was 7acba5f at the time, I get this error:

src/libtom/tomcrypt_cipher.h(546) : error C2133: 'cipher_descriptor' : unknown size
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\cl.exe' failed with exit status 2

I dumped the full output here: https://gist.github.com/opalmer/e1b28cc50223629d9f62

Though this may be a bug in the upstream library since it looks like those files have not been modified much I'd thought I'd log this here in case someone else had the same issues.

solaris 10 install pycrypto error

error info๏ผš
bash-4.3# python setup.py build
running build
running build_py
running build_ext
running build_configure
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash._MD2' extension
/usr/lib/python2.6/pycc -Qunused-arguments -Qunused-arguments -KPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.6 -c src/MD2.c -o build/temp.solaris-2.10-sun4us-2.6/src/MD2.o
/usr/ucb/cc: language optional software package not installed
error: command '/usr/lib/python2.6/pycc' failed with exit status 1
bash-4.3#

How to require using Py2EXE

I cannot seem to get py2exe to include the module crypto I have tried everything that i know. Please advise what to do.

setup.py

from distutils.core import setup
import py2exe

setup(
    console=['encode.py'],
    options = {
        'py2exe': {
            'packages': ['pycrypt']
        }
    }
)

encode.py

import Crypto.Random
from Crypto.Cipher import AES
import hashlib


# salt size in bytes
SALT_SIZE = 16

# number of iterations in the key generation
NUMBER_OF_ITERATIONS = 20

# the size multiple required for AES
AES_MULTIPLE = 16



def generate_key(password, salt, iterations):
    assert iterations > 0

    key = password + salt

    for i in range(iterations):
        key = hashlib.sha256(key).digest()

    return key

def pad_text(text, multiple):
    extra_bytes = len(text) % multiple

    padding_size = multiple - extra_bytes

    padding = chr(padding_size) * padding_size

    padded_text = text + padding

    return padded_text

def unpad_text(padded_text):
    padding_size = ord(padded_text[-1])

    text = padded_text[:-padding_size]

    return text

def encrypt(plaintext, password):
    salt = Crypto.Random.get_random_bytes(SALT_SIZE)

    key = generate_key(password, salt, NUMBER_OF_ITERATIONS)

    cipher = AES.new(key, AES.MODE_ECB)

    padded_plaintext = pad_text(plaintext, AES_MULTIPLE)

    ciphertext = cipher.encrypt(padded_plaintext)

    ciphertext_with_salt = salt + ciphertext

    return ciphertext_with_salt

def decrypt(ciphertext, password):
    salt = ciphertext[0:SALT_SIZE]

    ciphertext_sans_salt = ciphertext[SALT_SIZE:]

    key = generate_key(password, salt, NUMBER_OF_ITERATIONS)

    cipher = AES.new(key, AES.MODE_ECB)

    padded_plaintext = cipher.decrypt(ciphertext_sans_salt)

    plaintext = unpad_text(padded_plaintext)

    return plaintext

key = generate_key("123123", "321321", 2);
encrypt = encrypt("hello world", key);
print encrypt
decrypt = decrypt(encrypt, key);
print decrypt

windows, virtualenvs and multiple users

I'm running Pycrypto under Windows in a virtualenv. Because I don't have a C compiler on that matchine, I downloaded an pre-built binary and ran "easy_install path-to-binary.exe".

Things work fine when I run it myself, but when my colleague Steve tries to run the same programs, he gets the message "ImportError: no module named Crypto"

here's the strange part. If Steve runs "easy_install path-to-binary.exe", then he can run the program, but I get the "no module named Crypto" error.

Any thoughts on why we can't share a virtualenv with PyCrypto?

Pycrypto 2.7a1 Install on OSX

I am trying to get Pycrypto 2.7a1 to install on yosemite (OSX). It won't. Pip doesn't show a 2.7a1 version, and if I install the tar.gz version it doesn't compile.

Is there another source to get it into a project I am building. I need to get it going ASAP

Leading null is lost in ElGamal encrypt/decrypt.

from Crypto import Random
from Crypto.Random import random
from Crypto.PublicKey import ElGamal

def generate_ElGamal(bits=2048):
'''
Generate an ElGamal object
param: bits The key length in bits
Return dict representing the key
'''

new_key = ElGamal.generate(bits, Random.new().read)
result = {}
for attr in new_key.keydata:
    result[attr] = getattr(new_key, attr)
return result

key = {'y': 5890402739836397474678819894905838533676148739738176774142965397298027916081389782398753182746113205824244413010980753079305134293803269063941409011498875734386570091569626313383674440237117626129867265783966138499035553304633306979395201360176697548509389645127339917121381547880841468211281181358516753779169695472532456787952794788255704603459265765742039103257472081377183226944659816271236873467173436303281477874253889965681824223497554412192956164882357054589909110314792690067882403549633861074796378760423095548120894429169261267502862542916707925325955302473355622741938660755355929864447939043377202878297L,
'p': 16919105307179256524542896109180976570659491121500270391789229525941934599095736338121818489787706172552232297345408952004467025006693481114963815198329035215093587386524345151352596949602933078245256513283485874599571089832761427710813625573333470774951712206903903535438683155360191121247350702472294801982555274142239059519917002476619227728445125897918171151363638314098143720772913366800532936529457498220304962543534765068329972604330870368747123729701012069698153257632524224737576458727734149376646790001033088225630185161106397490779899394153994617787042916367367717260653851306751839512621036655988540358359L,
'g': 15142865823909303201677983983818053552575447340256049484443219305994364752305273147552886133964641047764118222197941222218911327671397473255039905913582198397207500443517527569861023810569656653467569352816781472581568025976942367720875677640976729937209766027599033970921733841047490832242141236277060826577412738527655629755792878568024012082362756251401790420383175003241155418162061866016953138935032804154273927288143499017710607135170537961206662554978703359370244480111346088829866171947498101818417697251419487213407943961562535322051210235343039531429553502274024959278937685421647460035753261966161265734585L,
'x': 9886971981505252940687220757174129479017124538909570436117534406424162667540490806588649644534867522373816781614579453009989232443802014777287560822923138233800506728338718794207696638372859326372943457173864479362609448099704641298790428140863325438371208352670600292390400877583238698240231943390341652168670861295031606340397206294746112393044697179059915094265503474329474795988049508472194535296176362530521154371285316746909363733082533517997934301038831647812750004591177932013760451220439120581688174408917792422430671114467952690320897790332689992039334144644898417200680317938974389782476127298232043858607L}

result = generate_ElGamal()

print result

pubkey = ElGamal.construct((key['p'], key['g'], key['y']))
privkey = ElGamal.construct((key['p'], key['g'], key['y'], key['x']))
rnd = Random.new()
rnd2 = random.StrongRandom()
for i in range(10):
aeskey = chr(0)+rnd.read(31)

ciphertext = pubkey.encrypt(aeskey, rnd2.randint(1, pubkey.p-2))

plaintext = privkey.decrypt(ciphertext)
if plaintext != aeskey:
    print i
    print aeskey.encode('hex')
    print plaintext.encode('hex')
    print 

------------------------------------------------Output-----------------------------------
0
0022036663488a677d87b8349af5469483ea3b66ee849252e8b8dc35835e3406
22036663488a677d87b8349af5469483ea3b66ee849252e8b8dc35835e3406

1
007f45d7c49f0174431e8aefb1fe8fb1eab38bce42274add8f620b1469884926
7f45d7c49f0174431e8aefb1fe8fb1eab38bce42274add8f620b1469884926

2
0090f2c998355adbf84dcaac740477b3b95c1b36c8e78beec0b369073b618d7b
90f2c998355adbf84dcaac740477b3b95c1b36c8e78beec0b369073b618d7b

3
00d31252a04cf1ef1dfe34d0ca2468bb140d73827f763bd00a00b9a580aad1dd
d31252a04cf1ef1dfe34d0ca2468bb140d73827f763bd00a00b9a580aad1dd

4
00a9c4df65554d00ffaee29bdd4f451e83ec36029e46a1d21123872f1cc01e80
a9c4df65554d00ffaee29bdd4f451e83ec36029e46a1d21123872f1cc01e80

5
00c0dc9a8bd19c2231811ff0091b79d971012c62fe54dc201daa243488183d0a
c0dc9a8bd19c2231811ff0091b79d971012c62fe54dc201daa243488183d0a

6
007339ff2b88df091c202fd140c0b9de25868d0d4fb7ad2840c0dedda87f29f3
7339ff2b88df091c202fd140c0b9de25868d0d4fb7ad2840c0dedda87f29f3

7
006215b8683c8364096aead16081b6a67a08de10d5ebbc53c9b3a21cedcb22c4
6215b8683c8364096aead16081b6a67a08de10d5ebbc53c9b3a21cedcb22c4

8
00211c93c1177e92797bdee4c87fbdc4c263213bf59104428607eacfdb23b6ec
211c93c1177e92797bdee4c87fbdc4c263213bf59104428607eacfdb23b6ec

9
00cc6fdb4a4af9766610f7bcebb51e11122a633f98c4265fd8c7dbc5a045c3f8
cc6fdb4a4af9766610f7bcebb51e11122a633f98c4265fd8c7dbc5a045c3f8

Push PyCrypto release v2.7a1 to pypi

I see that there was a release v2.7a1 after the one which was pushed to pypi (v2.6.1). Any reason why the latest release was never pushed to pypi? If not, could the latest release be pushed?

2.7a1 seems to allow loading dsa keys with the same interface as rsa keys (via importKeys), which would be nice to have.

ECDSA support

This is as much a question as an issue: are there any plans to add support for ECDSA? The best option in python right now seems to be https://pypi.python.org/pypi/ecdsa which is both quite slow and comes with exciting disclaimers like:

This library does not protect against timing attacks. Do not allow attackers
to measure how long it takes you to generate a keypair or sign a message.

Exception during message handling: PID check failed. RNG must be re-initialized after fork(). Hint: Try Random.atfork()

On a multi core virtual machine with Redhat 7.1 the pycrypto library throws an exception with following trace

2015-06-10 09:39:31.261 2880 DEBUG keystoneclient.session [req-b4e32ed5-92e6-4397-94f0-061bef916f6e - admin] RESP: [201] content-length: 722 vary: X-Auth-Token connection: keep-alive date: Wed, 10 Jun 2015 16:39:31 GMT content-type: application/json x-openstack-request-id: req-b93a3fc7-e677-43bd-8292-23f002d29021
RESP BODY: {"trust": {"impersonation": true, "roles_links": {"self": "http://localhost:35357/v3/OS-TRUST/trusts/8b4ec0965d8843b891066be569a77a08/roles", "previous": null, "next": null}, "deleted_at": null, "trustor_user_id": "e631e6ad22804335985f7b649b153646", "links": {"self": "http://localhost:35357/v3/OS-TRUST/trusts/8b4ec0965d8843b891066be569a77a08"}, "roles": [{"id": "be0e7cedf14944a6b0fe957f99a06506", "links": {"self": "http://localhost:35357/v3/roles/be0e7cedf14944a6b0fe957f99a06506"}, "name": "admin"}], "redelegation_count": 0, "remaining_uses": null, "expires_at": null, "trustee_user_id": "ae21a19e0fbb460eb68592cf6c6f5d34", "project_id": "50a0a9df745141cdb78b8adb340d8875", "id": "8b4ec0965d8843b891066be569a77a08"}}
_http_log_response /usr/lib/python2.7/site-packages/keystoneclient/session.py:224
2015-06-10 09:39:31.262 2880 ERROR oslo_messaging.rpc.dispatcher [req-b4e32ed5-92e6-4397-94f0-061bef916f6e - admin] Exception during message handling: PID check failed. RNG must be re-initialized after fork(). Hint: Try Random.atfork()
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher Traceback (most recent call last):
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 142, in _dispatch_and_reply
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher executor_callback))
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 186, in _dispatch
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher executor_callback)
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 130, in _do_dispatch
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher result = func(ctxt, *_new_args)
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 105, in wrapper
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher return f(_args, *_kwargs)
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/heat/common/context.py", line 300, in wrapped
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher return func(self, ctx, *args, *_kwargs)
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/heat/engine/service.py", line 671, in create_stack
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher stack.store()
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 105, in wrapper
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher return f(_args, *_kwargs)
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/heat/engine/stack.py", line 458, in store
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher new_creds = ucreds_object.UserCreds.create(trust_ctx)
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/heat/objects/user_creds.py", line 62, in create
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher user_creds_db = db_api.user_creds_create(context)
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/heat/db/api.py", line 180, in user_creds_create
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher return IMPL.user_creds_create(context)
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/heat/db/sqlalchemy/api.py", line 507, in user_creds_create
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher method, trust_id = _encrypt(values.get('trust_id'))
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/heat/db/sqlalchemy/api.py", line 205, in _encrypt
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher return crypt.encrypt(value.encode('utf-8'))
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/heat/common/crypt.py", line 38, in encrypt
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher auth_info, b64encode=True)
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/heat/openstack/common/crypto/utils.py", line 145, in encrypt
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher iv = Random.new().read(self.cipher.block_size)
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 202, in read
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher return self._singleton.read(bytes)
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 178, in read
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher return _UserFriendlyRNG.read(self, bytes)
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 137, in read
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher self._check_pid()
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 153, in _check_pid
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher raise AssertionError("PID check failed. RNG must be re-initialized after fork(). Hint: Try Random.atfork()")
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher AssertionError: PID check failed. RNG must be re-initialized after fork(). Hint: Try Random.atfork()
2015-06-10 09:39:31.262 2880 TRACE oslo_messaging.rpc.dispatcher
2015-06-10 09:39:31.281 2880 DEBUG oslo_messaging._drivers.amqp [req-b4e32ed5-92e6-4397-94f0-061bef916f6e - admin] Pool creating new connection create /usr/lib/python2.7/site-packages/oslo_messaging/_drivers/amqp.py:92

When i change the setting of this VM and make it single core then this same code works without any issues.

Pycrypto version is 2.6.1

pip show pycrypto

Metadata-Version: 1.1
Name: pycrypto
Version: 2.6.1
Summary: Cryptographic modules for Python.
Home-page: http://www.pycrypto.org/
Author: Dwayne C. Litzenberger
Author-email: [email protected]
License: UNKNOWN
Location: /usr/lib64/python2.7/site-packages
Requires:

This isn't a bug it's just feedback (test results for Py 3.4 on OS X Mavericks)

Results of test suite on OS X 10.9.5 with Python 3.4.2

Note: this version of OS X replaces gcc with clang and libstdc++ with libc++ (the latter may not be relevant, I didn't notice any C++ compilation messages fly past, but I wasn't looking that closely).

bash4-4.3$ python3.4 setup.py test
running test
running build
running build_py
creating build
creating build/lib.macosx-10.6-intel-3.4
creating build/lib.macosx-10.6-intel-3.4/Crypto
copying lib/Crypto/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto
copying lib/Crypto/pct_warnings.py -> build/lib.macosx-10.6-intel-3.4/Crypto
creating build/lib.macosx-10.6-intel-3.4/Crypto/Hash
copying lib/Crypto/Hash/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Hash
copying lib/Crypto/Hash/CMAC.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Hash
copying lib/Crypto/Hash/HMAC.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Hash
copying lib/Crypto/Hash/MD5.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Hash
copying lib/Crypto/Hash/RIPEMD.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Hash
copying lib/Crypto/Hash/SHA.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Hash
copying lib/Crypto/Hash/SHA1.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Hash
creating build/lib.macosx-10.6-intel-3.4/Crypto/Cipher
copying lib/Crypto/Cipher/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Cipher
copying lib/Crypto/Cipher/AES.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Cipher
copying lib/Crypto/Cipher/ARC2.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Cipher
copying lib/Crypto/Cipher/ARC4.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Cipher
copying lib/Crypto/Cipher/blockalgo.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Cipher
copying lib/Crypto/Cipher/Blowfish.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Cipher
copying lib/Crypto/Cipher/CAST.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Cipher
copying lib/Crypto/Cipher/DES.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Cipher
copying lib/Crypto/Cipher/DES3.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Cipher
copying lib/Crypto/Cipher/PKCS1_OAEP.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Cipher
copying lib/Crypto/Cipher/PKCS1_v1_5.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Cipher
copying lib/Crypto/Cipher/XOR.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Cipher
creating build/lib.macosx-10.6-intel-3.4/Crypto/Util
copying lib/Crypto/Util/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Util
copying lib/Crypto/Util/_number_new.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Util
copying lib/Crypto/Util/_time.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Util
copying lib/Crypto/Util/asn1.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Util
copying lib/Crypto/Util/Counter.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Util
copying lib/Crypto/Util/number.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Util
copying lib/Crypto/Util/Padding.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Util
copying lib/Crypto/Util/py3compat.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Util
copying lib/Crypto/Util/randpool.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Util
copying lib/Crypto/Util/RFC1751.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Util
copying lib/Crypto/Util/winrandom.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Util
creating build/lib.macosx-10.6-intel-3.4/Crypto/Random
copying lib/Crypto/Random/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Random
copying lib/Crypto/Random/_UserFriendlyRNG.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Random
copying lib/Crypto/Random/random.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Random
creating build/lib.macosx-10.6-intel-3.4/Crypto/Random/Fortuna
copying lib/Crypto/Random/Fortuna/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Random/Fortuna
copying lib/Crypto/Random/Fortuna/FortunaAccumulator.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Random/Fortuna
copying lib/Crypto/Random/Fortuna/FortunaGenerator.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Random/Fortuna
copying lib/Crypto/Random/Fortuna/SHAd256.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Random/Fortuna
creating build/lib.macosx-10.6-intel-3.4/Crypto/Random/OSRNG
copying lib/Crypto/Random/OSRNG/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Random/OSRNG
copying lib/Crypto/Random/OSRNG/fallback.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Random/OSRNG
copying lib/Crypto/Random/OSRNG/posix.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Random/OSRNG
copying lib/Crypto/Random/OSRNG/rng_base.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Random/OSRNG
creating build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest
copying lib/Crypto/SelfTest/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest
copying lib/Crypto/SelfTest/st_common.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest
creating build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Cipher
copying lib/Crypto/SelfTest/Cipher/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Cipher
copying lib/Crypto/SelfTest/Cipher/common.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Cipher
copying lib/Crypto/SelfTest/Cipher/test_AES.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Cipher
copying lib/Crypto/SelfTest/Cipher/test_ARC2.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Cipher
copying lib/Crypto/SelfTest/Cipher/test_ARC4.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Cipher
copying lib/Crypto/SelfTest/Cipher/test_Blowfish.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Cipher
copying lib/Crypto/SelfTest/Cipher/test_CAST.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Cipher
copying lib/Crypto/SelfTest/Cipher/test_DES.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Cipher
copying lib/Crypto/SelfTest/Cipher/test_DES3.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Cipher
copying lib/Crypto/SelfTest/Cipher/test_pkcs1_15.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Cipher
copying lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Cipher
copying lib/Crypto/SelfTest/Cipher/test_XOR.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Cipher
creating build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Hash
copying lib/Crypto/SelfTest/Hash/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Hash
copying lib/Crypto/SelfTest/Hash/common.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Hash
copying lib/Crypto/SelfTest/Hash/test_CMAC.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Hash
copying lib/Crypto/SelfTest/Hash/test_HMAC.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Hash
copying lib/Crypto/SelfTest/Hash/test_MD2.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Hash
copying lib/Crypto/SelfTest/Hash/test_MD4.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Hash
copying lib/Crypto/SelfTest/Hash/test_MD5.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Hash
copying lib/Crypto/SelfTest/Hash/test_RIPEMD160.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Hash
copying lib/Crypto/SelfTest/Hash/test_SHA1.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Hash
copying lib/Crypto/SelfTest/Hash/test_SHA224.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Hash
copying lib/Crypto/SelfTest/Hash/test_SHA256.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Hash
copying lib/Crypto/SelfTest/Hash/test_SHA384.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Hash
copying lib/Crypto/SelfTest/Hash/test_SHA512.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Hash
creating build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Protocol
copying lib/Crypto/SelfTest/Protocol/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Protocol
copying lib/Crypto/SelfTest/Protocol/test_AllOrNothing.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Protocol
copying lib/Crypto/SelfTest/Protocol/test_chaffing.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Protocol
copying lib/Crypto/SelfTest/Protocol/test_KDF.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Protocol
copying lib/Crypto/SelfTest/Protocol/test_rfc1751.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Protocol
creating build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/PublicKey
copying lib/Crypto/SelfTest/PublicKey/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/PublicKey
copying lib/Crypto/SelfTest/PublicKey/test_DSA.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/PublicKey
copying lib/Crypto/SelfTest/PublicKey/test_ElGamal.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/PublicKey
copying lib/Crypto/SelfTest/PublicKey/test_import_DSA.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/PublicKey
copying lib/Crypto/SelfTest/PublicKey/test_import_RSA.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/PublicKey
copying lib/Crypto/SelfTest/PublicKey/test_RSA.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/PublicKey
creating build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random
copying lib/Crypto/SelfTest/Random/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random
copying lib/Crypto/SelfTest/Random/test__UserFriendlyRNG.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random
copying lib/Crypto/SelfTest/Random/test_random.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random
copying lib/Crypto/SelfTest/Random/test_rpoolcompat.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random
creating build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random/Fortuna
copying lib/Crypto/SelfTest/Random/Fortuna/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random/Fortuna
copying lib/Crypto/SelfTest/Random/Fortuna/test_FortunaAccumulator.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random/Fortuna
copying lib/Crypto/SelfTest/Random/Fortuna/test_FortunaGenerator.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random/Fortuna
copying lib/Crypto/SelfTest/Random/Fortuna/test_SHAd256.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random/Fortuna
creating build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random/OSRNG
copying lib/Crypto/SelfTest/Random/OSRNG/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random/OSRNG
copying lib/Crypto/SelfTest/Random/OSRNG/test_fallback.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random/OSRNG
copying lib/Crypto/SelfTest/Random/OSRNG/test_generic.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random/OSRNG
copying lib/Crypto/SelfTest/Random/OSRNG/test_nt.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random/OSRNG
copying lib/Crypto/SelfTest/Random/OSRNG/test_posix.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random/OSRNG
copying lib/Crypto/SelfTest/Random/OSRNG/test_winrandom.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Random/OSRNG
creating build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Util
copying lib/Crypto/SelfTest/Util/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Util
copying lib/Crypto/SelfTest/Util/test_asn1.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Util
copying lib/Crypto/SelfTest/Util/test_Counter.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Util
copying lib/Crypto/SelfTest/Util/test_number.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Util
copying lib/Crypto/SelfTest/Util/test_Padding.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Util
copying lib/Crypto/SelfTest/Util/test_winrandom.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Util
creating build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Signature
copying lib/Crypto/SelfTest/Signature/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Signature
copying lib/Crypto/SelfTest/Signature/test_pkcs1_15.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Signature
copying lib/Crypto/SelfTest/Signature/test_pkcs1_pss.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/Signature
creating build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/IO
copying lib/Crypto/SelfTest/IO/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/IO
copying lib/Crypto/SelfTest/IO/test_PKCS8.py -> build/lib.macosx-10.6-intel-3.4/Crypto/SelfTest/IO
creating build/lib.macosx-10.6-intel-3.4/Crypto/Protocol
copying lib/Crypto/Protocol/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Protocol
copying lib/Crypto/Protocol/AllOrNothing.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Protocol
copying lib/Crypto/Protocol/Chaffing.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Protocol
copying lib/Crypto/Protocol/KDF.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Protocol
creating build/lib.macosx-10.6-intel-3.4/Crypto/PublicKey
copying lib/Crypto/PublicKey/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/PublicKey
copying lib/Crypto/PublicKey/_DSA.py -> build/lib.macosx-10.6-intel-3.4/Crypto/PublicKey
copying lib/Crypto/PublicKey/_RSA.py -> build/lib.macosx-10.6-intel-3.4/Crypto/PublicKey
copying lib/Crypto/PublicKey/_slowmath.py -> build/lib.macosx-10.6-intel-3.4/Crypto/PublicKey
copying lib/Crypto/PublicKey/DSA.py -> build/lib.macosx-10.6-intel-3.4/Crypto/PublicKey
copying lib/Crypto/PublicKey/ElGamal.py -> build/lib.macosx-10.6-intel-3.4/Crypto/PublicKey
copying lib/Crypto/PublicKey/pubkey.py -> build/lib.macosx-10.6-intel-3.4/Crypto/PublicKey
copying lib/Crypto/PublicKey/RSA.py -> build/lib.macosx-10.6-intel-3.4/Crypto/PublicKey
creating build/lib.macosx-10.6-intel-3.4/Crypto/Signature
copying lib/Crypto/Signature/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Signature
copying lib/Crypto/Signature/PKCS1_PSS.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Signature
copying lib/Crypto/Signature/PKCS1_v1_5.py -> build/lib.macosx-10.6-intel-3.4/Crypto/Signature
creating build/lib.macosx-10.6-intel-3.4/Crypto/IO
copying lib/Crypto/IO/__init__.py -> build/lib.macosx-10.6-intel-3.4/Crypto/IO
copying lib/Crypto/IO/_PBES.py -> build/lib.macosx-10.6-intel-3.4/Crypto/IO
copying lib/Crypto/IO/PEM.py -> build/lib.macosx-10.6-intel-3.4/Crypto/IO
copying lib/Crypto/IO/PKCS8.py -> build/lib.macosx-10.6-intel-3.4/Crypto/IO
Skipping implicit fixer: buffer
Skipping implicit fixer: idioms
Skipping implicit fixer: set_literal
Skipping implicit fixer: ws_comma
running build_ext
running build_configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/tmp/pycrypto/build-aux/missing: Unknown '--is-lightweight' option
Try '/tmp/pycrypto/build-aux/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
checking for a thread-safe mkdir -p... /opt/local/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... none
checking for gcc option to accept ISO C99... none needed
checking build system type... x86_64-apple-darwin13.4.0
checking host system type... x86_64-apple-darwin13.4.0
checking whether C compiler accepts -Wall... yes
checking whether C compiler accepts -Wextra... yes
checking whether C compiler accepts -Wno-missing-field-initializers... yes
checking whether C compiler accepts -Wno-unused-parameter... yes
checking whether C compiler accepts -maes... yes
checking for __gmpz_init in -lgmp... no
checking for __gmpz_init in -lmpir... no
checking whether mpz_powm is declared... no
checking whether mpz_powm_sec is declared... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for inttypes.h... (cached) yes
checking sys/inttypes.h usability... no
checking sys/inttypes.h presence... no
checking for sys/inttypes.h... no
checking cpuid.h usability... yes
checking cpuid.h presence... yes
checking for cpuid.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking wmmintrin.h usability... yes
checking wmmintrin.h presence... yes
checking for wmmintrin.h... yes
checking for inline... inline
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for int8_t... yes
checking for size_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uint8_t... yes
checking for uintptr_t... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for memmove... yes
checking for memset... yes
checking for posix_memalign... yes
checking for aligned_alloc... no
checking for _aligned_malloc... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating buildenv
config.status: creating src/config.h
config.status: executing depfiles commands
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash.MD2' extension
creating build/temp.macosx-10.6-intel-3.4
creating build/temp.macosx-10.6-intel-3.4/src
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/MD2.c -o build/temp.macosx-10.6-intel-3.4/src/MD2.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/MD2.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Hash/MD2.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/MD2.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/MD2.o
building 'Crypto.Hash.MD4' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/MD4.c -o build/temp.macosx-10.6-intel-3.4/src/MD4.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/MD4.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Hash/MD4.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/MD4.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/MD4.o
building 'Crypto.Hash.SHA256' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/SHA256.c -o build/temp.macosx-10.6-intel-3.4/src/SHA256.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/SHA256.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Hash/SHA256.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/SHA256.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/SHA256.o
building 'Crypto.Hash.SHA224' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/SHA224.c -o build/temp.macosx-10.6-intel-3.4/src/SHA224.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/SHA224.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Hash/SHA224.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/SHA224.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/SHA224.o
building 'Crypto.Hash.SHA384' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/SHA384.c -o build/temp.macosx-10.6-intel-3.4/src/SHA384.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/SHA384.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Hash/SHA384.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/SHA384.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/SHA384.o
building 'Crypto.Hash.SHA512' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/SHA512.c -o build/temp.macosx-10.6-intel-3.4/src/SHA512.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/SHA512.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Hash/SHA512.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/SHA512.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/SHA512.o
building 'Crypto.Hash.RIPEMD160' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -DPCT_LITTLE_ENDIAN=1 -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/RIPEMD160.c -o build/temp.macosx-10.6-intel-3.4/src/RIPEMD160.o
src/RIPEMD160.c:213:20: warning: unused function 'byteswap_digest'
      [-Wunused-function]
static inline void byteswap_digest(uint32_t *p)
                   ^
1 warning generated.
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/RIPEMD160.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Hash/RIPEMD160.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/RIPEMD160.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/RIPEMD160.o
building 'Crypto.Cipher._AES' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/AES.c -o build/temp.macosx-10.6-intel-3.4/src/AES.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/AES.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Cipher/_AES.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/AES.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/AES.o
building 'Crypto.Cipher._AESNI' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/AESNI.c -o build/temp.macosx-10.6-intel-3.4/src/AESNI.o -maes
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/AESNI.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Cipher/_AESNI.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/AESNI.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/AESNI.o
building 'Crypto.Cipher._ARC2' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/ARC2.c -o build/temp.macosx-10.6-intel-3.4/src/ARC2.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/ARC2.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Cipher/_ARC2.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/ARC2.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/ARC2.o
building 'Crypto.Cipher._Blowfish' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/Blowfish.c -o build/temp.macosx-10.6-intel-3.4/src/Blowfish.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/Blowfish.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Cipher/_Blowfish.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/Blowfish.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/Blowfish.o
building 'Crypto.Cipher._CAST' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/CAST.c -o build/temp.macosx-10.6-intel-3.4/src/CAST.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/CAST.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Cipher/_CAST.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/CAST.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/CAST.o
building 'Crypto.Cipher._DES' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -Isrc/libtom/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/DES.c -o build/temp.macosx-10.6-intel-3.4/src/DES.o
In file included from src/DES.c:34:
In file included from src/libtom/tomcrypt_des.c:11:
In file included from src/libtom/tomcrypt.h:68:
src/libtom/tomcrypt_cipher.h:546:3: warning: tentative array definition assumed
      to have one element
} cipher_descriptor[];
  ^
1 warning generated.
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/DES.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Cipher/_DES.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/DES.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/DES.o
building 'Crypto.Cipher._DES3' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -Isrc/libtom/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/DES3.c -o build/temp.macosx-10.6-intel-3.4/src/DES3.o
In file included from src/DES3.c:26:
In file included from src/DES.c:34:
In file included from src/libtom/tomcrypt_des.c:11:
In file included from src/libtom/tomcrypt.h:68:
src/libtom/tomcrypt_cipher.h:546:3: warning: tentative array definition assumed
      to have one element
} cipher_descriptor[];
  ^
1 warning generated.
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/DES3.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Cipher/_DES3.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/DES3.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/DES3.o
building 'Crypto.Cipher._ARC4' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/ARC4.c -o build/temp.macosx-10.6-intel-3.4/src/ARC4.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/ARC4.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Cipher/_ARC4.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/ARC4.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/ARC4.o
building 'Crypto.Cipher._XOR' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/XOR.c -o build/temp.macosx-10.6-intel-3.4/src/XOR.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/XOR.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Cipher/_XOR.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/XOR.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/XOR.o
building 'Crypto.Util.strxor' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/strxor.c -o build/temp.macosx-10.6-intel-3.4/src/strxor.o
src/strxor.c:30:19: warning: unused variable 'rcsid' [-Wunused-const-variable]
static const char rcsid[] = "$Id$";
                  ^
1 warning generated.
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/strxor.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Util/strxor.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/strxor.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/strxor.o
building 'Crypto.Util.cpuid' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/cpuid.c -o build/temp.macosx-10.6-intel-3.4/src/cpuid.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/cpuid.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Util/cpuid.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/cpuid.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/cpuid.o
building 'Crypto.Util._galois' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/galois.c -o build/temp.macosx-10.6-intel-3.4/src/galois.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/galois.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Util/_galois.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/galois.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/galois.o
building 'Crypto.Util._counter' extension
gcc -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H -Isrc/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c src/_counter.c -o build/temp.macosx-10.6-intel-3.4/src/_counter.o
gcc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g -g -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -DHAVE_CONFIG_H build/temp.macosx-10.6-intel-3.4/src/_counter.o -o build/lib.macosx-10.6-intel-3.4/Crypto/Util/_counter.so
ld: warning: ignoring file build/temp.macosx-10.6-intel-3.4/src/_counter.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (i386): build/temp.macosx-10.6-intel-3.4/src/_counter.o
SelfTest: warning: not testing _fastmath module (not available)
SelfTest: warning: not testing _fastmath module (not available)
SelfTest: warning: not testing _fastmath module (not available)
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................SelfTest: You can ignore the RandomPool_DeprecationWarning that follows.
...................................................
----------------------------------------------------------------------
Ran 1821 tests in 50.983s

OK
bash4-4.3$ 

There are a handful of warnings in there, but it doesn't look like anything to be concerned about (actually, this thing did very well, especially compared to the last beta of GPG 2.1).

python setup.py build - error

Hi,
I'm a newbie to to RPi and Python. I'm trying to install Pycrypo onto a Raspberry Pi.
I have run sudo python setup.py build
And i get an error message at the end:

configure: creating ./config.status
config.status: creating src/config.h
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash._MD2' extension
creating build/temp.linux-armv7l-2.7
creating build/temp.linux-armv7l-2.7/src
gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-armv7l-2.7/src/MD2.o
src/MD2.c:31:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

Anyone know what i'm doing wrong or know what i should do to fix?

Many thanks.

/dev/urandom produced truncated output

Name: pycrypto
Version: 2.6.1
Location: /usr/local/lib/python2.7/dist-packages

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.2 LTS"

Stack trace:
File "/usr/local/lib/python2.7/dist-packages/Crypto/Random/random.py", line 102, in choice#012 return seq[self.randrange(len(seq))]#12
File "/usr/local/lib/python2.7/dist-packages/Crypto/Random/random.py", line 83, in randrange#012 r = self.getrandbits(size(num_choices))#12
File "/usr/local/lib/python2.7/dist-packages/Crypto/Random/random.py", line 51, in getrandbits#012 return mask & bytes_to_long(self._randfunc(ceil_div(k, 8)))#12
File "/usr/local/lib/python2.7/dist-packages/Crypto/Random/_UserFriendlyRNG.py", line 202, in read#012 return self._singleton.read(bytes)#12
File "/usr/local/lib/python2.7/dist-packages/Crypto/Random/_UserFriendlyRNG.py", line 178, in read#012 return _UserFriendlyRNG.read(self, bytes)#12
File "/usr/local/lib/python2.7/dist-packages/Crypto/Random/_UserFriendlyRNG.py", line 129, in read#012 self._ec.collect()#12
File "/usr/local/lib/python2.7/dist-packages/Crypto/Random/_UserFriendlyRNG.py", line 70, in collect#012 self._osrng_es.feed(self._osrng.read(8))#12
File "/usr/local/lib/python2.7/dist-packages/Crypto/Random/OSRNG/rng_base.py", line 78, in read#012 raise AssertionError("%s produced truncated output (requested %d, got %d)" % (self.name, N, len(data)))

May 7 10:57:22 dhcp-172-18-225-77 syslog_logger:6569:CRITICAL:LogUncaughtException:51: <type 'exceptions.AssertionError'>: /dev/urandom produced truncated output (requested 8, got 0)

Broken build in 2.6.1

I'm using pip with python 2.7.8 on OS X 10.10.1, while installing pycrypto 2.6.1 from pypi I get

running build_configure
configure: error: cannot find sources (src/pycrypto_compat.h) in /opt/local/share/luarocks/bin or ..

this is the same issue shown in this thread, the displayed directory is the first in PATH having a file named "configure".

An user should be able to run 'pip install pycrypto' and get the package installed even if he has some script named "configure" in one of the directory in his PATH.

There seems to be an issue with the distutils setup for the package and should be fixed, other distutils packages using configure work fine.

A workaround is suggested here, i.e. you have to simply specify "./configure" rather than "configure" as the pthon python argument in the source directory:

./configure
python ./setup.py build
python ./setup.py install

ImportError: No module named 'winrandom'

I tried 3 approaches:
a) Binary build v2.6.1
b) pip install pycrypto
c) manual install v2.7a1

C:\Python34\pycrypto-2.7a1>c:\Python34\python.exe setup.py build
running build
running build_py
running build_ext
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.


Second pass to allow 2to3 to fix nt.py. No cause for alarm.

running build
running build_py
copying lib\Crypto\Random\OSRNG\nt.py -> build\lib.win32-3.4\Crypto\Random\OSRNG

Skipping implicit fixer: buffer
Skipping implicit fixer: idioms
Skipping implicit fixer: set_literal
Skipping implicit fixer: ws_comma
running build_ext
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.

All give the same error, namely that winrandom is missing.
I tried to build windrandom (https://pypi.python.org/pypi/winrandom/1.2) as well (also builds fine, but I still get the same error about it missing.

C:\Python34\winrandom-1.2\winrandom-1.2>python counterpartyd\counterparty-cli.py --help
Traceback (most recent call last):
  File "c:\counterpartyd_build\dist\counterpartyd\counterparty-cli.py", line 14,
 in <module>
    from Crypto.PublicKey import RSA
  File "C:\Python34\lib\site-packages\Crypto\PublicKey\RSA.py", line 78, in <mod
ule>
    from Crypto import Random
  File "C:\Python34\lib\site-packages\Crypto\Random\__init__.py", line 28, in <m
odule>
    from Crypto.Random import OSRNG
  File "C:\Python34\lib\site-packages\Crypto\Random\OSRNG\__init__.py", line 34,
 in <module>
    from Crypto.Random.OSRNG.nt import new
  File "C:\Python34\lib\site-packages\Crypto\Random\OSRNG\nt.py", line 28, in <m
odule>
    import winrandom
ImportError: No module named 'winrandom'

C:\Python34\winrandom-1.2\winrandom-1.2>python -V
Python 3.4.2

I'm not sure if I'm missing something obvious here?

long_to_bytes returns zero buffer for negative inputs

python -i
Python 2.7.8 (default, Apr 15 2015, 09:26:55)
[GCC 4.9.2 20150212 (Red Hat 4.9.2-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import Crypto.Util.number
Crypto.Util.number.long_to_bytes(-1, 8)
'\x00\x00\x00\x00\x00\x00\x00\x00'

A workaround is to do bitwise and with an appropriately-sized hex literal first:

Crypto.Util.number.long_to_bytes(-1 & 0xffffffffffffffff, 8)
'\xff\xff\xff\xff\xff\xff\xff\xff'

This is definitely a bug, because the API documentation does not say the long input must be nonnegative. The question is whether it is a bug in the documentation, the implementation, or both. I do not have much to say about that question except to suggest that silently failing is generally not good behavior, especially for a cryptography library.

AES-NI to slow

Today I did a test and encryped as many blocks as possible with AES.
The numbers variate around almost the same amount, whether I use use_aesni=True or use_aesni=False.
I checked with python -v and _AESNI.c is loaded at runtime.
How can that be?
If I test with openssl speed AESNI is up to 6 times faster than plain AES.

self-test when fastmath not installed

Here is a suggested change to Crypto/SelfTest/Util/test_number.py, lines 279-286 for when fastmath is None. fastpath NOT installed triggers a rsa_construct() not a member msg.

def test_negative_number_roundtrip_mpzToLongObj_longObjToMPZ(self):
    """Test that mpzToLongObj and longObjToMPZ (internal functions) roundtrip negative numbers correctly."""
    if number._fastmath:        # can be None if fastmath not installed
        n = -100000000000000000000000000000000000L
        e = 2L
        k = number._fastmath.rsa_construct(n, e)
        self.assertEqual(n, k.n)
        self.assertEqual(e, k.e)

Perhaps you want to add a warning when fastmath is not installed?

Attribute Error PKCS keys

When creating a PKCS or PSS key for encryption or signing, you have to be sure to pass it an original RSA key. If I create a PSS from a private PKCS key, I run into a few AttributeErrors because self._key becomes self._key._key

I propose that the init for PKCS and PSS be more intelligent as follows (in pseudocode)

def __init__(self, key):
    if hasattr(key, "_key"):
        self._key = key._key
    else:
        self._key = key

Thoughts?

cannot import name OSRNG

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8080/

Django Version: 1.5.8
Python Version: 2.7.6
Installed Applications:
('django.contrib.sites',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'dsp',
'frontend',
'ckeditor',
'social.apps.django_app.default',
'sorl.thumbnail')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')

Traceback:
File "/home/ri/studio/project/google-cloud-sdk/platform/google_appengine/lib/django-1.5/django/core/handlers/base.py" in get_response

  1.                 resolver_match = resolver.resolve(request.path_info)
    
    File "/home/ri/studio/project/google-cloud-sdk/platform/google_appengine/lib/django-1.5/django/core/urlresolvers.py" in resolve
  2.         for pattern in self.url_patterns:
    
    File "/home/ri/studio/project/google-cloud-sdk/platform/google_appengine/lib/django-1.5/django/core/urlresolvers.py" in url_patterns
  3.     patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
    
    File "/home/ri/studio/project/google-cloud-sdk/platform/google_appengine/lib/django-1.5/django/core/urlresolvers.py" in urlconf_module
  4.         self._urlconf_module = import_module(self.urlconf_name)
    
    File "/home/ri/studio/project/google-cloud-sdk/platform/google_appengine/lib/django-1.5/django/utils/importlib.py" in import_module
  5. **import**(name)
    
    File "/home/ri/studio/engineapp/Audiotube/audiotube/urls.py" in
  6. from dsp import views
    File "/home/ri/studio/engineapp/Audiotube/dsp/views.py" in
  7. import paramiko
    File "/home/ri/studio/engineapp/Audiotube/lib/paramiko/init.py" in
  8. from transport import SecurityOptions, Transport
    File "/home/ri/studio/engineapp/Audiotube/lib/paramiko/transport.py" in
  9. from paramiko import util
    File "/home/ri/studio/engineapp/Audiotube/lib/paramiko/util.py" in
  10. from paramiko.common import *
    File "/home/ri/studio/engineapp/Audiotube/lib/paramiko/common.py" in
  11. from Crypto import Random
    File "/home/ri/studio/engineapp/Audiotube/lib/Crypto/Random/init.py" in
  12. from Crypto.Random import OSRNG

Exception Type: ImportError at /
Exception Value: cannot import name OSRNG

Installation failed Solaris 9 Sparc

I tried to install the library "pycrypto" version 2.6.1 on a Solaris server 9. But there is a compilation error about a missing file.

SunOS 5.9 Generic_118558-06 sun4u sparc SUNW,Sun-Fire-V240
gcc version 3.3.2

Output :
running install running build running build_py creating build creating build/lib.solaris-2.9-sun4u.32bit-2.7 creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto copying lib/Crypto/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto copying lib/Crypto/pct_warnings.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash copying lib/Crypto/Hash/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash copying lib/Crypto/Hash/SHA224.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash copying lib/Crypto/Hash/SHA384.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash copying lib/Crypto/Hash/SHA.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash copying lib/Crypto/Hash/MD4.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash copying lib/Crypto/Hash/RIPEMD.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash copying lib/Crypto/Hash/MD2.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash copying lib/Crypto/Hash/HMAC.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash copying lib/Crypto/Hash/SHA512.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash copying lib/Crypto/Hash/hashalgo.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash copying lib/Crypto/Hash/SHA256.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash copying lib/Crypto/Hash/MD5.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Cipher copying lib/Crypto/Cipher/PKCS1_OAEP.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Cipher copying lib/Crypto/Cipher/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Cipher copying lib/Crypto/Cipher/DES.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Cipher copying lib/Crypto/Cipher/ARC4.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Cipher copying lib/Crypto/Cipher/XOR.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Cipher copying lib/Crypto/Cipher/CAST.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Cipher copying lib/Crypto/Cipher/PKCS1_v1_5.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Cipher copying lib/Crypto/Cipher/blockalgo.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Cipher copying lib/Crypto/Cipher/AES.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Cipher copying lib/Crypto/Cipher/ARC2.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Cipher copying lib/Crypto/Cipher/DES3.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Cipher copying lib/Crypto/Cipher/Blowfish.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Cipher creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Util copying lib/Crypto/Util/asn1.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Util copying lib/Crypto/Util/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Util copying lib/Crypto/Util/_number_new.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Util copying lib/Crypto/Util/winrandom.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Util copying lib/Crypto/Util/Counter.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Util copying lib/Crypto/Util/RFC1751.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Util copying lib/Crypto/Util/py21compat.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Util copying lib/Crypto/Util/randpool.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Util copying lib/Crypto/Util/py3compat.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Util copying lib/Crypto/Util/number.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Util creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random copying lib/Crypto/Random/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random copying lib/Crypto/Random/_UserFriendlyRNG.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random copying lib/Crypto/Random/random.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random/Fortuna copying lib/Crypto/Random/Fortuna/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random/Fortuna copying lib/Crypto/Random/Fortuna/SHAd256.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random/Fortuna copying lib/Crypto/Random/Fortuna/FortunaGenerator.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random/Fortuna copying lib/Crypto/Random/Fortuna/FortunaAccumulator.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random/Fortuna creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random/OSRNG copying lib/Crypto/Random/OSRNG/posix.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random/OSRNG copying lib/Crypto/Random/OSRNG/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random/OSRNG copying lib/Crypto/Random/OSRNG/fallback.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random/OSRNG copying lib/Crypto/Random/OSRNG/nt.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random/OSRNG copying lib/Crypto/Random/OSRNG/rng_base.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Random/OSRNG creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest copying lib/Crypto/SelfTest/st_common.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest copying lib/Crypto/SelfTest/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_pkcs1_15.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_ARC4.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_AES.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_ARC2.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_Blowfish.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_XOR.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_DES.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/common.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_CAST.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Cipher copying lib/Crypto/SelfTest/Cipher/test_DES3.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Cipher creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA256.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_MD2.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_HMAC.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA384.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_RIPEMD.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_MD5.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/common.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_MD4.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA224.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Hash copying lib/Crypto/SelfTest/Hash/test_SHA512.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Hash creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/test_rfc1751.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/test_chaffing.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/test_KDF.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Protocol copying lib/Crypto/SelfTest/Protocol/test_AllOrNothing.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Protocol creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/test_ElGamal.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/test_DSA.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/test_RSA.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/PublicKey copying lib/Crypto/SelfTest/PublicKey/test_importKey.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/PublicKey creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random copying lib/Crypto/SelfTest/Random/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random copying lib/Crypto/SelfTest/Random/test_random.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random copying lib/Crypto/SelfTest/Random/test_rpoolcompat.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random copying lib/Crypto/SelfTest/Random/test__UserFriendlyRNG.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random/Fortuna copying lib/Crypto/SelfTest/Random/Fortuna/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random/Fortuna copying lib/Crypto/SelfTest/Random/Fortuna/test_FortunaAccumulator.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random/Fortuna copying lib/Crypto/SelfTest/Random/Fortuna/test_FortunaGenerator.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random/Fortuna copying lib/Crypto/SelfTest/Random/Fortuna/test_SHAd256.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random/Fortuna creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_generic.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_nt.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_fallback.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_winrandom.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random/OSRNG copying lib/Crypto/SelfTest/Random/OSRNG/test_posix.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Random/OSRNG creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/test_asn1.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/test_number.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/test_winrandom.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Util copying lib/Crypto/SelfTest/Util/test_Counter.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Util creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Signature copying lib/Crypto/SelfTest/Signature/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Signature copying lib/Crypto/SelfTest/Signature/test_pkcs1_15.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Signature copying lib/Crypto/SelfTest/Signature/test_pkcs1_pss.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/SelfTest/Signature creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Protocol copying lib/Crypto/Protocol/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Protocol copying lib/Crypto/Protocol/KDF.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Protocol copying lib/Crypto/Protocol/Chaffing.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Protocol copying lib/Crypto/Protocol/AllOrNothing.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Protocol creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/PublicKey copying lib/Crypto/PublicKey/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/PublicKey copying lib/Crypto/PublicKey/_RSA.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/PublicKey copying lib/Crypto/PublicKey/ElGamal.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/PublicKey copying lib/Crypto/PublicKey/_DSA.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/PublicKey copying lib/Crypto/PublicKey/DSA.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/PublicKey copying lib/Crypto/PublicKey/RSA.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/PublicKey copying lib/Crypto/PublicKey/pubkey.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/PublicKey copying lib/Crypto/PublicKey/_slowmath.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/PublicKey creating build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Signature copying lib/Crypto/Signature/__init__.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Signature copying lib/Crypto/Signature/PKCS1_v1_5.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Signature copying lib/Crypto/Signature/PKCS1_PSS.py -> build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Signature running build_ext running build_configure checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for __gmpz_init in -lgmp... no checking for __gmpz_init in -lmpir... no checking whether mpz_powm is declared... no checking whether mpz_powm_sec is declared... no checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /usr/xpg4/bin/grep checking for egrep... /usr/xpg4/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... no checking for unistd.h... yes checking for inttypes.h... (cached) yes checking limits.h usability... yes checking limits.h presence... yes checking for limits.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking for stdint.h... (cached) no checking for stdlib.h... (cached) yes checking for string.h... (cached) yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for inline... inline checking for int16_t... yes checking for int32_t... yes checking for int64_t... yes checking for int8_t... yes checking for size_t... yes checking for uint16_t... yes checking for uint32_t... yes checking for uint64_t... yes checking for uint8_t... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible malloc... yes checking for memmove... yes checking for memset... yes configure: creating ./config.status config.status: creating src/config.h warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath. building 'Crypto.Hash._MD2' extension creating build/temp.solaris-2.9-sun4u.32bit-2.7 creating build/temp.solaris-2.9-sun4u.32bit-2.7/src gcc -fno-strict-aliasing -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/home/Gi/admin/python/py2.7.10SSL/include/python2.7 -c src/MD2.c -o build/temp.solaris-2.9-sun4u.32bit-2.7/src/MD2.o In file included from /home/Gi/admin/python/py2.7.10SSL/include/python2.7/Python.h:8, from src/MD2.c:31: /home/Gi/admin/python/py2.7.10SSL/include/python2.7/pyconfig.h:1163:1: warning: "_FILE_OFFSET_BITS" redefined In file included from /usr/include/iso/string_iso.h:31, from /usr/include/string.h:18, from src/MD2.c:30: /usr/include/sys/feature_tests.h:96:1: warning: this is the location of the previous definition gcc -shared -R /usr/local/lib -R /usr/local/ssl/lib build/temp.solaris-2.9-sun4u.32bit-2.7/src/MD2.o -o build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash/_MD2.so building 'Crypto.Hash._MD4' extension gcc -fno-strict-aliasing -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/home/Gi/admin/python/py2.7.10SSL/include/python2.7 -c src/MD4.c -o build/temp.solaris-2.9-sun4u.32bit-2.7/src/MD4.o In file included from /home/Gi/admin/python/py2.7.10SSL/include/python2.7/Python.h:8, from src/MD4.c:31: /home/Gi/admin/python/py2.7.10SSL/include/python2.7/pyconfig.h:1163:1: warning: "_FILE_OFFSET_BITS" redefined In file included from /usr/include/iso/string_iso.h:31, from /usr/include/string.h:18, from src/MD4.c:30: /usr/include/sys/feature_tests.h:96:1: warning: this is the location of the previous definition gcc -shared -R /usr/local/lib -R /usr/local/ssl/lib build/temp.solaris-2.9-sun4u.32bit-2.7/src/MD4.o -o build/lib.solaris-2.9-sun4u.32bit-2.7/Crypto/Hash/_MD4.so building 'Crypto.Hash._SHA256' extension gcc -fno-strict-aliasing -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/home/Gi/admin/python/py2.7.10SSL/include/python2.7 -c src/SHA256.c -o build/temp.solaris-2.9-sun4u.32bit-2.7/src/SHA256.o In file included from src/SHA256.c:35: src/hash_SHA2.h:72:20: stdint.h: No such file or directory In file included from src/SHA256.c:35: src/hash_SHA2.h:73: error: parse error before "U8" src/hash_SHA2.h:73: warning: type defaults to int' in declaration of U8' src/hash_SHA2.h:73: warning: data definition has no type or storage class src/hash_SHA2.h:74: error: parse error before "U32" src/hash_SHA2.h:74: warning: type defaults to int' in declaration of U32' src/hash_SHA2.h:74: warning: data definition has no type or storage class src/hash_SHA2.h:75: error: parse error before "U64" src/hash_SHA2.h:75: warning: type defaults to int' in declaration of U64' src/hash_SHA2.h:75: warning: data definition has no type or storage class src/hash_SHA2.h:91: error: parse error before "sha2_word_t" src/hash_SHA2.h:91: warning: type defaults to int' in declaration of sha2_word_t' src/hash_SHA2.h:91: warning: data definition has no type or storage class src/hash_SHA2.h:98: error: parse error before "sha2_word_t" src/hash_SHA2.h:98: warning: no semicolon at end of struct or union src/hash_SHA2.h:100: error: parse error before "length_upper" src/hash_SHA2.h:100: warning: type defaults to int' in declaration of length_upper' src/hash_SHA2.h:100: warning: type defaults to int' in declaration of length_lower' src/hash_SHA2.h:100: warning: data definition has no type or storage class src/hash_SHA2.h:102: error: parse error before '}' token src/hash_SHA2.h:102: warning: type defaults to int' in declaration of hash_state' src/hash_SHA2.h:102: warning: data definition has no type or storage class src/SHA256.c:38: error: parse error before "H" src/SHA256.c:38: warning: type defaults to int' in declaration of H' src/SHA256.c:47: warning: data definition has no type or storage class src/SHA256.c:50: error: parse error before "K" src/SHA256.c:50: warning: type defaults to int' in declaration of K' src/SHA256.c:64: warning: data definition has no type or storage class In file included from src/SHA256.c:72: src/hash_SHA2_template.c:37: error: parse error before '*' token src/hash_SHA2_template.c:38: warning: function declaration isn't a prototype src/hash_SHA2_template.c: In function sha_compress':
src/hash_SHA2_template.c:39: error: parse error before "S"
src/hash_SHA2_template.c:44: error: S' undeclared (first use in this function) src/hash_SHA2_template.c:44: error: (Each undeclared identifier is reported only once src/hash_SHA2_template.c:44: error: for each function it appears in.) src/hash_SHA2_template.c:44: error: hs' undeclared (first use in this function)
src/hash_SHA2_template.c:48: error: W' undeclared (first use in this function) src/hash_SHA2_template.c:49: error: parse error before "hs" src/hash_SHA2_template.c:49: error: parse error before ']' token src/hash_SHA2_template.c:50: error: parse error before "hs" src/hash_SHA2_template.c:50: error: parse error before ']' token src/hash_SHA2_template.c:50: error: parse error before ')' token src/hash_SHA2_template.c:69: error: T1' undeclared (first use in this function)
src/hash_SHA2_template.c:70: error: T2' undeclared (first use in this function) src/hash_SHA2_template.c: At top level: src/hash_SHA2_template.c:90: error: parse error before '*' token src/hash_SHA2_template.c:90: warning: function declaration isn't a prototype src/hash_SHA2_template.c: In function add_length':
src/hash_SHA2_template.c:91: error: parse error before "overflow_detector"
src/hash_SHA2_template.c:92: error: overflow_detector' undeclared (first use in this function) src/hash_SHA2_template.c:92: error: hs' undeclared (first use in this function)
src/hash_SHA2_template.c:93: error: inc' undeclared (first use in this function) src/hash_SHA2_template.c: At top level: src/hash_SHA2_template.c:104: error: parse error before '*' token src/hash_SHA2_template.c:105: warning: function declaration isn't a prototype src/hash_SHA2_template.c: In function sha_init':
src/hash_SHA2_template.c:107: error: hs' undeclared (first use in this function) src/hash_SHA2_template.c: At top level: src/hash_SHA2_template.c:112: error: parse error before '*' token src/hash_SHA2_template.c:113: warning: function declaration isn't a prototype src/hash_SHA2_template.c: In function sha_process':
src/hash_SHA2_template.c:114: error: len' undeclared (first use in this function) src/hash_SHA2_template.c:116: error: hs' undeclared (first use in this function)
src/hash_SHA2_template.c:116: error: wrong type argument to increment
src/hash_SHA2_template.c: At top level:
src/hash_SHA2_template.c:127: error: parse error before '' token
src/hash_SHA2_template.c:128: warning: function declaration isn't a prototype
src/hash_SHA2_template.c: In function sha_done': src/hash_SHA2_template.c:132: error: hs' undeclared (first use in this function)
src/hash_SHA2_template.c:163: error: hash' undeclared (first use in this function) src/hash_SHA2_template.c: At top level: src/hash_SHA2_template.c:168: error: parse error before '*' token src/hash_SHA2_template.c:169: warning: function declaration isn't a prototype src/hash_SHA2_template.c: In function hash_init':
src/hash_SHA2_template.c:170: error: ptr' undeclared (first use in this function) src/hash_SHA2_template.c: At top level: src/hash_SHA2_template.c:175: error: parse error before '*' token src/hash_SHA2_template.c:176: warning: function declaration isn't a prototype src/hash_SHA2_template.c: In function hash_update':
src/hash_SHA2_template.c:177: error: self' undeclared (first use in this function) src/hash_SHA2_template.c:177: error: len' undeclared (first use in this function)
src/hash_SHA2_template.c: At top level:
src/hash_SHA2_template.c:182: error: parse error before '
' token
src/hash_SHA2_template.c:183: warning: function declaration isn't a prototype
src/hash_SHA2_template.c: In function hash_copy': src/hash_SHA2_template.c:184: error: dest' undeclared (first use in this function)
src/hash_SHA2_template.c:184: error: src' undeclared (first use in this function) src/hash_SHA2_template.c: At top level: src/hash_SHA2_template.c:189: warning: type defaults to int' in declaration of hash_state' src/hash_SHA2_template.c:189: error: parse error before '*' token src/hash_SHA2_template.c:190: warning: function declaration isn't a prototype src/hash_SHA2_template.c: In function hash_digest':
src/hash_SHA2_template.c:192: error: parse error before "temp"
src/hash_SHA2_template.c:194: error: parse error before ')' token
src/hash_SHA2_template.c:195: error: temp' undeclared (first use in this function) In file included from src/hash_SHA2_template.c:199, from src/SHA256.c:72: src/hash_template.c: At top level: src/hash_template.c:49: error: parse error before "hash_state" src/hash_template.c:49: warning: no semicolon at end of struct or union src/hash_template.c:50: warning: type defaults to int' in declaration of ALGobject' src/hash_template.c:50: warning: data definition has no type or storage class src/hash_template.c:64: error: parse error before '*' token src/hash_template.c:66: warning: return type defaults to int'
src/hash_template.c: In function newALGobject': src/hash_template.c:67: error: new' undeclared (first use in this function)
src/hash_template.c:69: error: parse error before ')' token
src/hash_template.c: In function ALG_dealloc': src/hash_template.c:78: error: self' undeclared (first use in this function)
src/hash_template.c:78: error: parse error before ')' token
src/hash_template.c: At top level:
src/hash_template.c:92: error: parse error before '' token
src/hash_template.c:93: warning: function declaration isn't a prototype
src/hash_template.c: In function ALG_copy': src/hash_template.c:94: error: newobj' undeclared (first use in this function)
src/hash_template.c:96: error: args' undeclared (first use in this function) src/hash_template.c:103: error: self' undeclared (first use in this function)
src/hash_template.c: At top level:
src/hash_template.c:111: error: parse error before '
' token
src/hash_template.c:112: warning: function declaration isn't a prototype
src/hash_template.c: In function ALG_digest': src/hash_template.c:113: error: args' undeclared (first use in this function)
src/hash_template.c:116: error: self' undeclared (first use in this function) src/hash_template.c: At top level: src/hash_template.c:123: error: parse error before '*' token src/hash_template.c:124: warning: function declaration isn't a prototype src/hash_template.c: In function ALG_hexdigest':
src/hash_template.c:129: error: args' undeclared (first use in this function) src/hash_template.c:133: error: self' undeclared (first use in this function)
In file included from src/hash_SHA2_template.c:199,
from src/SHA256.c:72:
src/hash_template.c: At top level:
src/hash_template.c:163: error: parse error before '*' token
src/hash_template.c:164: warning: function declaration isn't a prototype
src/hash_template.c: In function ALG_update': src/hash_template.c:168: error: args' undeclared (first use in this function)
src/hash_template.c:173: error: self' undeclared (first use in this function) src/hash_template.c: In function ALG_new':
src/hash_template.c:274: error: new' undeclared (first use in this function) error: command 'gcc' failed with exit status 1

CFB decryption algorithm incorrect (and buffer overrun)

The CFB algorithm is show in:
http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Feedback_.28CFB.29

Although the key encryption function is used in both encrypting and decrypting, the encrypting and decrypting algorithms are different, the are incorrectly the same in the pycrypto-2.6.1 code.

src/block_template.c:

  1. in ALG_Encrypt(ALGobject *self, PyObject *args)
    in case(MODE_CFB):
    line 548

the cipertext not the plaintext is used as the next IV, so the:
for (j=0; jsegment_size/8; j++) {
buffer[i+j] = str[i+j] ^ temp[j];
}

should be AFTER the:
if (self->segment_size == BLOCK_SIZE * 8) {
...

  1. line 553
    buffer[i+j] = str[i+j] ^ temp[j];

can write past the end if 'buffer' which is 'len' bytes long.

the code with both bugs fixed is:

src/block_template.c:548

case(MODE_CFB):
for(i=0; i<len; i+=self->segment_size/8)
{
block_encrypt(&(self->st), self->IV, temp);

if (self->segment_size == BLOCK_SIZE * 8) {
/* s == b: segment size is identical to
the algorithm block size /
memcpy(self->IV, str + i, BLOCK_SIZE);
}
else if ((self->segment_size % 8) == 0) {
int sz = self->segment_size/8;
memmove(self->IV, self->IV + sz,
BLOCK_SIZE-sz);
memcpy(self->IV + BLOCK_SIZE - sz, str + i,
sz);
}
else {
/
segment_size is not a multiple of 8;
currently this can't happen */
}

int segmentSize = self->segment_size / 8;
if (i + segmentSize > len) {
/* do not overwrite past end of 'buf' */
segmentSize = len - i;
}
for (int j = 0; j < segmentSize; j++) {
buf[i + j] = buf[i + j] ^ temp[j];
}

}
break;

Default initialization of counter value to 1 in lib/Crypto/Util/Counter.py

By default, the initial value of the counter used in implementation of the CTR mode is initialized to 1. It means that a developer forgetting to initialize the prefix to a random value will not experience any problem. This is a serious security issue, if the constructor is initialized two times and this counter is used with the same key. It transforms the CTR mode in a two-time pad, and such a mode is not secure anymore.

IMHO, the best way is to force the developer to initialize this value, by raising an exception if the counter and/or the nonce is not initialized. The possibility that it will set it to identical values will keep, but one gives him/her a chance to learn about the CTR mode and to implement properly the initialization.

Build issue on OSX Mavericks (10.9)

I know Apple is rapidly deprecating older OSX versions, but this is still a problem when trying to deploy -- looks like the pip formula for pycrypto passes a parameter that the version of gcc/clang provided by OSX 10.9's Xcode can't understand:

paramiko/paramiko#283

publickey().exportKey(format="OpenSSH") failing on python 3.4

On MacOSX 10.10
Python 3.4.2 installed from brew
pycrypto installed from pip
$ pip3 list|grep crypto
pycrypto (2.6.1)

>>> import Crypto
>>> Crypto.__version__
'2.6.1'
>>> key = Crypto.PublicKey.RSA.generate(4096)
>>> key
<_RSAobj @0x105c5a160 n(4096),e,d,p,q,u,private>
>>> key.publickey()
<_RSAobj @0x105c6afd0 n(4096),e>
>>> key.publickey().exportKey()
b'-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAyzwzfoNoYJHGOhDEtu/j\naxDVdF0yzINOWuAQzfgz0Jwu3uXgMX3X/u/DmddiR6Fi0VTZuoCz3UWyXEUYSHVQ\niE2/p68n319lLcVqX3x5pJzjnQwKndVec6JjhB7rNCauBCzenDIH8hKVN7ce4n84\nG6TjqeGUXmDNY+FspG1KPklGBkDwv9iJZeiMvtl73pmbaX0k6JpQrP+Ff30pzD6Q\n7xnWniSEjniFu/zLymjs6a9SWulbOMso0l4rT6mPHiQ4Ed88KsvWZ6Jcu5d5drld\nkdHJt/+ajTUce2kbjZzXjewKdnGFOB+/4f4FQX/N7Naca1nvw241+LAnzMjxyfOu\nEd8BoGhH30zkxjXDsDCCwH+YPcoO5QgiZd7QF91Msu7vFqbkHtfMvUrhAjzPpz8n\ntYRc6eAHSTPgnsQGyiTp8ySqhtCOIk2klYpcOPmtHBEgzi8ktLMXRSUtMiRGeo3v\n5ilreVtVlKS6KIpJLsjzVtLj5PiXPOokOsCCKunBe6RBcUMVrWwrKdKOKJsQblie\nYxX5Dk8W/ioqbD4z7da4NQdLOyq+kDBdLwktT4sDOCG8mAj0Jh6iwTUzA1lUDG1m\n6VQ1sA5GDSk0T1xNBSsm2fOyg26iaZ6BB5iwdSF45ECeRqLS2BQTRRpZePCIOAq7\nx1yNDQzyBrOk/6dCROMTK4kCAwEAAQ==\n-----END PUBLIC KEY-----'
>>> key.publickey().exportKey(format="OpenSSH")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/site-packages/Crypto/PublicKey/RSA.py", line 352, in exportKey
    keystring = ''.join([ struct.pack(">I",len(kp))+kp for kp in keyparts])
  File "/usr/local/lib/python3.4/site-packages/Crypto/PublicKey/RSA.py", line 352, in <listcomp>
    keystring = ''.join([ struct.pack(">I",len(kp))+kp for kp in keyparts])
TypeError: can't concat bytes to str

Seems that in the case of:

keystring = ''.join([ struct.pack(">I",len(kp))+kp for kp in keyparts])

kp is a string so we cant concat it with the result of struck.pack() which is indeed a byte object.

Attribute Error 'can_decrypt' (RSA key)

from Crypto.Cipher import PKCS1_OAEP as oaep
from Crypto.PublicKey import RSA
key = RSA.generate(2048)
pkcs = oaep.new(key)
pkcs.can_decrypt()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-233-a54ca29e70fc> in <module>()
----> 1 pkcs.can_decrypt()

/usr/lib/python2.7/site-packages/Crypto/Cipher/PKCS1_OAEP.pyc in can_decrypt(self)
    109     def can_decrypt(self):
    110         """Return True/1 if this cipher object can be used for decryption."""
--> 111         return self._key.can_decrypt()
    112 
    113     def encrypt(self, message):

/usr/lib/python2.7/site-packages/Crypto/PublicKey/RSA.pyc in __getattr__(self, attrname)
    124             return getattr(self.key, attrname)
    125         else:
--> 126             raise AttributeError("%s object has no %r attribute" % (self.__class__.__name__, attrname,))
    127 
    128     def encrypt(self, plaintext, K):

AttributeError: _RSAobj object has no 'can_decrypt' attribute

An RSA key object has no 'can_decrypt' attribute.

Error when trying to install pycrypto

Running pycrypto-2.6.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-rJNJO4/pycrypto-2.6.1/egg-dist-tmp-Xwh5m3
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: Setup script exited with error: command 'cc' failed with exit status 1

I used the command sudo pip install pycrypto.

randfunc isn't passed around to all functions (possible issue?)

I'm not sure if this is an issue to be fixed or not, but it is something that I recently ran into.

There are many places where randfunc isn't passed between functions, specifically in lib/Crypto/Util/number.py

There are many spots where this occurs, but one example is https://github.com/dlitz/pycrypto/blob/master/lib/Crypto/Util/number.py#L305

We ran into this issue when a Windows machine was erroring when we were attempting to generate an RSA key using lib/Crypto/PublicKey/RSA.generate When we tried to pass in a randfunc to the generate function, we got further along, but the same error happened again later on in the code.

I'm definitely an amateur in this area, but when passing in a randfunc, is there a reason it shouldn't be used everywhere?

AESNI.c needs -std=c99 or -std=c11 to be defined

The default flags for the compilation don't have std defined.
Alternatively you could just change

 static void aes_key_setup_dec(__m128i dk[], const __m128i ek[], int rounds)
 {
     dk[rounds] = ek[0];
-    for (int i = 1; i < rounds; ++i) {
+    int i;
+    for (i = 1; i < rounds; ++i) {
         dk[rounds - i] = _mm_aesimc_si128(ek[i]);
     }
     dk[0] = ek[rounds];

But this probably won't be the preferred solution since the style -std=c11

Provide a BibTeX entry

PyCrypto is likely be used as a tool in research papers due to the ubiquity of Python programming language in the scientific community. As such, you should really provide a BibTeX entry in the README to ensure a correct attribution of your work.

AES.MODE_CBC is broken

OS: OSX 10.10.3
Python: 3.4.3
System language: Korean

I'm not good to English, look at this codes.

>>> from Crypto.Cipher import AES
>>> aes = AES.new('asdfasdfasdfasdf', AES.MODE_CBC, 'asdfasdfasdfasdf')
>>> cat = 'long cat is looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong'
>>> aes.decrypt(aes.encrypt(cat))
b'\xd2\xc8*\x9bs\xda9.\x08{\xb1\xfa5\xfc\x0f\xf1oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong'
>>> aes.decrypt(aes.encrypt(cat))                                                   
b'\xbdO9uU\xea=r\x8f\xa9\x9aRdC\r{oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong'
>>> aes.decrypt(aes.encrypt(cat))
b'\xf1\x99\xbc\x9b0\xfeu\x1f\xdeA\xe6q \x1d!\xcdoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong'
>>> aes.decrypt(aes.encrypt(cat))
b'\xa4\x8f\xd3m\xc2\xb1T\xb2\xc5\xd3\xb8m$x\x8d\xe1oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong'
>>> aes.decrypt(aes.encrypt(cat))
b'J\x9a\xd8N\xf0/v]b\xfb\x9f\x80%:B\xceoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong'
>>> aes.decrypt(aes.encrypt(cat))
b"\x8b\t\xf1\x0f\xea'\xd8\xd0\x86\xa4<\xb5\xcc\x0e3\xc5oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"
>>> aes.decrypt(aes.encrypt(cat))
b'\xd3\xa0\x8e~\xaa\x90s>7rJ\xe7\x84\x8c\x1d\x95oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong'
>>> aes.decrypt(aes.encrypt(cat))
b'\x9a\xea&h-+\xbd\x891>\xa2!.\x17\xb9Joooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong'

I tried another key that different with iv

>>> aes = AES.new('1234123412341234', AES.MODE_CBC, 'asdfasdfasdfasdf')                  
>>> aes.decrypt(aes.encrypt(cat))
b'x\xc78\xd0\xebr.Y\x98\xcd`\xdd\x9f`\xe2\x93oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong'

I can't understand it and I tried it on pgsql and it works fine.

item4=# select encode(decrypt_iv(encrypt_iv('long cat is looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong', 'asdfasdfasdfasdf', 'asdfasdfasdfasdf', 'aes-cbc/pad:none'), 'asdfasdfasdfasdf', 'asdfasdfasdfasdf', 'aes-cbc/pad:none'), 'escape');
                                                      encode                                                      
------------------------------------------------------------------------------------------------------------------
 long cat is looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
(1 row)

And I tried it on cryptography too.

>>> from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
>>> from cryptography.hazmat.backends import default_backend
>>> key = b'asdfasdfasdfasdf'
>>> iv = b'asdfasdfasdfasdf'
>>> backend = default_backend()
>>> cipher = Cipher(algorithms.AES(key), modes.CBC(iv), backend=backend)
>>> encryptor = cipher.encryptor()
>>> ct = encryptor.update(b'long cat is looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong')
>>> ct += encryptor.finalize()
>>> decryptor = cipher.decryptor()
>>> (decryptor.update(ct) + decryptor.finalize()).decode('u8')
'long cat is looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong'

I think it's not AES's problem.

AES and RC4 modules horribly slow (or SHA256 amazingly fast)

This ticket might be related to #101.

I am creating CSPRNGs in various languages, and started with implementing the DRBG found in ANSI x9.17. I have written Perl and Python versions replacing 3DES with AES, RC4, and SHA-256. Other than some minor language specifics, as well as how each module is used, this pastebin shows some strange timings: http://ae7.st/p/67q

Working through 1,000 random numbers, all Perl implementations seem to be hovering around 3-4s in execution time- Rijndael, RC4, and SHA-256. For Python, the AES and ARC4 implementations sit around 13-14 seconds to process 1,000 random numbers, but SHA-256 completes all 1,000 rounds in around one-tenth of a second (0.1).

I know comparing performance benchmarks of AES to RC4 and SHA-256 isn't exactly apples-to-apples (let alone comparing Perl to Python). However, I would expect the AES and RC4 performance to be more the ballpark of what I'm seeing with Perl. And because the SHA256 module performs so amazingly well, I would expect the AES and ARC4 modules to do even better.

pip install places pycrypto in lowercase 'crypto' on windows.

Windows XP SP4, Python 2.7

python -m pip install pycrypto succeeds after installing the compiler, but it fails to load:

>>> from Crypto.Cipher import AES
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Crypto.Cipher
>>> from crypto.Cipher import AES
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\crypto\Cipher\AES.py", line 49, in <module
>
    from Crypto.Cipher import blockalgo
ImportError: No module named Crypto.Cipher

Notice 'crypto' in site-packages is lowercase? Renaming it to 'Crypto' seems to solve the issue.

No release in ages

It's been two years since the last release, but there are important changes in master that should be released. Will we see another release soon?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.