]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - src/Crypto/README
move all packages into src/, fix allmydata.Crypto build. Now you must perform a ...
[tahoe-lafs/tahoe-lafs.git] / src / Crypto / README
1 Python Cryptography Toolkit (pycrypto)
2 ======================================
3
4 This is a collection of both secure hash functions (such as MD5 and SHA),
5 and various encryption algorithms (AES, DES, IDEA, RSA, ElGamal, etc.).  The
6 package is structured to make adding new modules easy.  I consider this
7 section to be essentially complete, and the software interface will almost
8 certainly not change in an incompatible way in the future; all that remains
9 to be done is to fix any bugs that show up.  If you encounter a bug, please
10 report it in the SourceForge bug tracker at
11        https://sourceforge.net/tracker/?group_id=20937&atid=120937
12   
13 An example usage of the MD5 module is:
14 >>> from Crypto.Hash import MD5
15 >>> hash=MD5.new()
16 >>> hash.update('message')
17 >>> hash.digest()
18 'x\xe71\x02}\x8f\xd5\x0e\xd6B4\x0b|\x9ac\xb3'
19
20 An example usage of an encryption algorithm (AES, in this case) is:
21
22 >>> from Crypto.Cipher import AES
23 >>> obj=AES.new('This is a key456', AES.MODE_ECB)
24 >>> message="The answer is no"
25 >>> ciphertext=obj.encrypt(message)
26 >>> ciphertext
27 'o\x1aq_{P+\xd0\x07\xce\x89\xd1=M\x989'
28 >>> obj2 = AES.new('This is a key456', AES.MODE_ECB)
29 >>> obj2.decrypt(ciphertext)
30 'The answer is no'
31
32 One possible application of the modules is writing secure
33 administration tools.  Another application is in writing daemons and
34 servers.  Clients and servers can encrypt the data being exchanged and
35 mutually authenticate themselves; daemons can encrypt private data for
36 added security.  Python also provides a pleasant framework for
37 prototyping and experimentation with cryptographic algorithms; thanks
38 to its arbitrary-length integers, public key algorithms are easily
39 implemented.
40
41 Development of the toolkit can be discussed on the pct mailing list;
42 archives and instructions for subscribing at at 
43 <URL:http://www.amk.ca/mailman/listinfo/pct>.
44
45
46 Installation
47 ============
48
49 The toolkit is written and tested using Python 2.2, though it should
50 also work with Python 2.1.  Python 1.5.2 is not supported, and the
51 setup.py script will abort if you run it with 1.5.2.
52
53 The modules are packaged using the Distutils, so you can simply run
54 "python setup.py build" to build the package, and "python setup.py
55 install" to install it.
56
57 If the setup.py script crashes with a DistutilsPlatformError
58 complaining that the file /usr/lib/python2.2/config/Makefile doesn't
59 exist, this means that the files needed for compiling new Python
60 modules aren't installed on your system.  Red Hat users often run into
61 this because they don't have the python2-devel RPM installed.  The fix
62 is to simply install the requisite RPM.
63
64 To verify that everything is in order, run "python test.py".  It will test
65 all the cryptographic modules, skipping ones that aren't available.  If the
66 test script reports an error on your machine, please report the bug using
67 the bug tracker (URL given above).  If possible, track down the bug and
68 include a patch that fixes it.
69
70 To install the package under the site-packages directory of
71 your Python installation, run "python setup.py install".
72
73 If you have any comments, corrections, or improvements for this package,
74 please send it to the 'pct' mailing list.  Good luck!
75
76 --amk                                                       (www.amk.ca)