File: README

package info (click to toggle)
python-crypto 2.0%2Bdp1-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 752 kB
  • ctags: 927
  • sloc: ansic: 6,584; python: 3,578; makefile: 64; sh: 10
file content (82 lines) | stat: -rw-r--r-- 3,481 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Python Cryptography Toolkit (pycrypto) 2.0	
==========================================

This is a collection of both secure hash functions (such as MD5 and
SHA), and various encryption algorithms (AES, DES, IDEA, RSA, ElGamal,
etc.).  The package is structured to make adding new modules easy.  I
consider this section to be 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 inform me immediately.  If you
implement a new algorithm, please send me a copy.

An example usage of the MD5 module is:
>>> from Crypto.Hash import MD5
>>> hash=MD5.new()
>>> hash.update('message')
>>> hash.digest()
'x\xe71\x02}\x8f\xd5\x0e\xd6B4\x0b|\x9ac\xb3'

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

>>> from Crypto.Cipher import AES
>>> obj=AES.new('This is a key456', AES.MODE_ECB)
>>> message="The answer is no"
>>> ciphertext=obj.encrypt(message)
>>> ciphertext
'o\x1aq_{P+\xd0\x07\xce\x89\xd1=M\x989'
>>> obj.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.

Development of the toolkit can be discussed on the pct mailing list;
archives and instructions for subscribing at at 
<URL:http://www.amk.ca/mailman/listinfo/pct>.

For general discussion about using Python for cryptography-related
tasks, join the python-crypto mailing list.  Archives and instructions
for subscribing are at
<URL:http://listserv.surfnet.nl/archives/python-crypto.html>.


Installation
============

The toolkit is written and tested using Python 2.2, though it should
also work with Python 2.1.  Python 1.5.2 is not supported, and the
setup.py script will abort if you run it with 1.5.2.

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.

To verify that everything is in order, run "python test.py".  It will
test all the cryptographic modules, skipping ones that aren't
available.  If the test script reports an error on your machine,
please inform me immediately, because that means there's a serious bug
somewhere in the cryptographic routines.  (Alternatively, track down
the bug and send me a patch.)

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 e-mail me at the address below, or send it to the
python-crypto mailing list.  Good luck!

--amk                                                       (www.amk.ca)