pycrypto


Namepycrypto JSON
Version 2.6.1 PyPI version JSON
download
home_pagehttp://www.pycrypto.org/
SummaryCryptographic modules for Python.
upload_time2014-06-20 08:10:20
maintainer
docs_urlhttps://pythonhosted.org/pycrypto/
authorDwayne C. Litzenberger
requires_pythonNone
licensePublic domain
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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 Launchpad bug tracker at

       https://launchpad.net/products/pycrypto/+bugs

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.

If the setup.py script crashes with a DistutilsPlatformError
complaining that the file /usr/lib/python2.2/config/Makefile doesn't
exist, this means that the files needed for compiling new Python
modules aren't installed on your system.  Red Hat users often run into
this because they don't have the python2-devel RPM installed.  The fix
is to simply install the requisite RPM.  On Debian/Ubuntu, you need the
python-dev package.

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
http://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:

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

Raw data

            {
    "_id": null,
    "home_page": "http://www.pycrypto.org/",
    "name": "pycrypto",
    "maintainer": "",
    "docs_url": "https://pythonhosted.org/pycrypto/",
    "requires_python": null,
    "maintainer_email": "",
    "keywords": "",
    "author": "Dwayne C. Litzenberger",
    "author_email": "dlitz@dlitz.net",
    "download_url": "https://files.pythonhosted.org/packages/60/db/645aa9af249f059cc3a368b118de33889219e0362141e75d4eaf6f80f163/pycrypto-2.6.1.tar.gz",
    "platform": "",
    "description": "Python Cryptography Toolkit (pycrypto)\r\n======================================\r\n\r\nThis is a collection of both secure hash functions (such as SHA256 and\r\nRIPEMD160), and various encryption algorithms (AES, DES, RSA, ElGamal,\r\netc.).  The package is structured to make adding new modules easy.\r\nThis section is essentially complete, and the software interface will\r\nalmost certainly not change in an incompatible way in the future; all\r\nthat remains to be done is to fix any bugs that show up.  If you\r\nencounter a bug, please report it in the Launchpad bug tracker at\r\n\r\n       https://launchpad.net/products/pycrypto/+bugs\r\n\r\nAn example usage of the SHA256 module is:\r\n\r\n>>> from Crypto.Hash import SHA256\r\n>>> hash = SHA256.new()\r\n>>> hash.update('message')\r\n>>> hash.digest()\r\n'\\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'\r\n\r\nAn example usage of an encryption algorithm (AES, in this case) is:\r\n\r\n>>> from Crypto.Cipher import AES\r\n>>> obj = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456')\r\n>>> message = \"The answer is no\"\r\n>>> ciphertext = obj.encrypt(message)\r\n>>> ciphertext\r\n'\\xd6\\x83\\x8dd!VT\\x92\\xaa`A\\x05\\xe0\\x9b\\x8b\\xf1'\r\n>>> obj2 = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456')\r\n>>> obj2.decrypt(ciphertext)\r\n'The answer is no'\r\n\r\nOne possible application of the modules is writing secure\r\nadministration tools.  Another application is in writing daemons and\r\nservers.  Clients and servers can encrypt the data being exchanged and\r\nmutually authenticate themselves; daemons can encrypt private data for\r\nadded security.  Python also provides a pleasant framework for\r\nprototyping and experimentation with cryptographic algorithms; thanks\r\nto its arbitrary-length integers, public key algorithms are easily\r\nimplemented.\r\n\r\nAs of PyCrypto 2.1.0, PyCrypto provides an easy-to-use random number\r\ngenerator:\r\n\r\n>>> from Crypto import Random\r\n>>> rndfile = Random.new()\r\n>>> rndfile.read(16)\r\n'\\xf7.\\x838{\\x85\\xa0\\xd3>#}\\xc6\\xc2jJU'\r\n\r\nA stronger version of Python's standard \"random\" module is also\r\nprovided:\r\n\r\n>>> from Crypto.Random import random\r\n>>> random.choice(['dogs', 'cats', 'bears'])\r\n'bears'\r\n\r\nCaveat: For the random number generator to work correctly, you must\r\ncall Random.atfork() in both the parent and child processes after\r\nusing os.fork()\r\n\r\n\r\nInstallation\r\n============\r\n\r\nPyCrypto is written and tested using Python version 2.1 through 3.3.  Python\r\n1.5.2 is not supported.\r\n\r\nThe modules are packaged using the Distutils, so you can simply run\r\n\"python setup.py build\" to build the package, and \"python setup.py\r\ninstall\" to install it.\r\n\r\nIf the setup.py script crashes with a DistutilsPlatformError\r\ncomplaining that the file /usr/lib/python2.2/config/Makefile doesn't\r\nexist, this means that the files needed for compiling new Python\r\nmodules aren't installed on your system.  Red Hat users often run into\r\nthis because they don't have the python2-devel RPM installed.  The fix\r\nis to simply install the requisite RPM.  On Debian/Ubuntu, you need the\r\npython-dev package.\r\n\r\nTo verify that everything is in order, run \"python setup.py test\".  It\r\nwill test all the cryptographic modules, skipping ones that aren't\r\navailable.  If the test script reports an error on your machine,\r\nplease report the bug using the bug tracker (URL given above).  If\r\npossible, track down the bug and include a patch that fixes it,\r\nprovided that you are able to meet the eligibility requirements at\r\nhttp://www.pycrypto.org/submission-requirements/.\r\n\r\nIt is possible to test a single sub-package or a single module only, for instance\r\nwhen you investigate why certain tests fail and don't want to run the whole\r\nsuite each time. Use \"python setup.py test --module=name\", where 'name'\r\nis either a sub-package (Cipher, PublicKey, etc) or a module (Cipher.DES,\r\nPublicKey.RSA, etc).\r\nTo further cut test coverage, pass also the option \"--skip-slow-tests\".\r\n\r\nTo install the package under the site-packages directory of\r\nyour Python installation, run \"python setup.py install\".\r\n\r\nIf you have any comments, corrections, or improvements for this\r\npackage, please report them to our mailing list, accessible via the\r\nPyCrypto website:\r\n\r\n    http://www.pycrypto.org/\r\n    https://www.dlitz.net/software/pycrypto/",
    "bugtrack_url": null,
    "license": "Public domain",
    "summary": "Cryptographic modules for Python.",
    "version": "2.6.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "55a61a054aa66812daf5161a0d5d7eda",
                "sha256": "f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c"
            },
            "downloads": -1,
            "filename": "pycrypto-2.6.1.tar.gz",
            "has_sig": true,
            "md5_digest": "55a61a054aa66812daf5161a0d5d7eda",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 446240,
            "upload_time": "2014-06-20T08:10:20",
            "upload_time_iso_8601": "2014-06-20T08:10:20.813938Z",
            "url": "https://files.pythonhosted.org/packages/60/db/645aa9af249f059cc3a368b118de33889219e0362141e75d4eaf6f80f163/pycrypto-2.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2014-06-20 08:10:20",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "pycrypto"
}
        
Elapsed time: 0.08082s