Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
PyPI

pycrypto 2.6.1

pip install pycrypto

Latest version

Released:

Cryptographic modules for Python.

Verified details

These details have beenverified by PyPI
Maintainers
Avatar for amk from gravatar.comamkAvatar for dlitz from gravatar.comdlitz

Unverified details

These details havenot been verified by PyPI
Project links
Meta
Classifiers

Project description

Python Cryptography Toolkit (pycrypto)

This is a collection of both secure hash functions (such as SHA256 andRIPEMD160), 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 willalmost certainly not change in an incompatible way in the future; allthat remains to be done is to fix any bugs that show up. If youencounter 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 secureadministration tools. Another application is in writing daemons andservers. Clients and servers can encrypt the data being exchanged andmutually authenticate themselves; daemons can encrypt private data foradded security. Python also provides a pleasant framework forprototyping and experimentation with cryptographic algorithms; thanksto its arbitrary-length integers, public key algorithms are easilyimplemented.

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

>>> 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 alsoprovided:

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

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

Installation

PyCrypto is written and tested using Python version 2.1 through 3.3. Python1.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.pyinstall” to install it.

If the setup.py script crashes with a DistutilsPlatformErrorcomplaining that the file /usr/lib/python2.2/config/Makefile doesn’texist, this means that the files needed for compiling new Pythonmodules aren’t installed on your system. Red Hat users often run intothis because they don’t have the python2-devel RPM installed. The fixis to simply install the requisite RPM. On Debian/Ubuntu, you need thepython-dev package.

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

It is possible to test a single sub-package or a single module only, for instancewhen you investigate why certain tests fail and don’t want to run the wholesuite 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 ofyour Python installation, run “python setup.py install”.

If you have any comments, corrections, or improvements for thispackage, please report them to our mailing list, accessible via thePyCrypto website:

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

Project details

Verified details

These details have beenverified by PyPI
Maintainers
Avatar for amk from gravatar.comamkAvatar for dlitz from gravatar.comdlitz

Unverified details

These details havenot been verified by PyPI
Project links
Meta
Classifiers

Download files

Download the file for your platform. If you're not sure which to choose, learn more aboutinstalling packages.

Source Distribution

pycrypto-2.6.1.tar.gz (446.2 kBview details)

UploadedSource

File details

Details for the filepycrypto-2.6.1.tar.gz.

File metadata

  • Download URL:pycrypto-2.6.1.tar.gz
  • Upload date:
  • Size: 446.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pycrypto-2.6.1.tar.gz
AlgorithmHash digest
SHA256f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c
MD555a61a054aa66812daf5161a0d5d7eda
BLAKE2b-25660db645aa9af249f059cc3a368b118de33889219e0362141e75d4eaf6f80f163

See more details on using hashes here.

Supported by

AWS Cloud computing and Security SponsorDatadog MonitoringDepot Continuous IntegrationFastly CDNGoogle Download AnalyticsPingdom MonitoringSentry Error loggingStatusPage Status page

[8]ページ先頭

©2009-2025 Movatter.jp