PageRenderTime 30ms CodeModel.GetById 23ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/Crypto/Cipher/__init__.py

https://gitlab.com/grayhamster/pycrypto
Python | 83 lines | 50 code | 1 blank | 32 comment | 1 complexity | 62be7a636888584668d923d4ba82bb91 MD5 | raw file
 1# -*- coding: utf-8 -*-
 2#
 3# ===================================================================
 4# The contents of this file are dedicated to the public domain.  To
 5# the extent that dedication to the public domain is not available,
 6# everyone is granted a worldwide, perpetual, royalty-free,
 7# non-exclusive license to exercise all rights associated with the
 8# contents of this file for any purpose whatsoever.
 9# No rights are reserved.
10#
11# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
12# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
13# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
15# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
16# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
17# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18# SOFTWARE.
19# ===================================================================
20
21"""Symmetric- and asymmetric-key encryption algorithms.
22
23Encryption algorithms transform plaintext in some way that
24is dependent on a key or key pair, producing ciphertext.
25
26Symmetric algorithms
27--------------------
28
29Encryption can easily be reversed, if (and, hopefully, only if)
30one knows the same key.
31In other words, sender and receiver share the same key.
32
33The symmetric encryption modules here all support the interface described in PEP
34272, "API for Block Encryption Algorithms".
35
36If you don't know which algorithm to choose, use AES because it's
37standard and has undergone a fair bit of examination.
38
39========================    =======   ========================
40Module name                 Type      Description
41========================    =======   ========================
42`Crypto.Cipher.AES`         Block     Advanced Encryption Standard
43`Crypto.Cipher.ARC2`        Block     Alleged RC2
44`Crypto.Cipher.ARC4`        Stream    Alleged RC4
45`Crypto.Cipher.Blowfish`    Block     Blowfish
46`Crypto.Cipher.CAST`        Block     CAST
47`Crypto.Cipher.DES`         Block     The Data Encryption Standard.
48                                      Very commonly used in the past,
49                                      but today its 56-bit keys are too small.
50`Crypto.Cipher.DES3`        Block     Triple DES.
51`Crypto.Cipher.XOR`         Stream    The simple XOR cipher.
52========================    =======   ========================
53
54
55Asymmetric algorithms
56---------------------
57
58For asymmetric algorithms, the key to be used for decryption is totally
59different and cannot be derived in a feasible way from the key used
60for encryption. Put differently, sender and receiver each own one half
61of a key pair. The encryption key is often called ``public`` whereas
62the decryption key is called ``private``.
63
64==========================    =======================
65Module name                   Description
66==========================    =======================
67`Crypto.Cipher.PKCS1_v1_5`    PKCS#1 v1.5 encryption, based on RSA key pairs
68`Crypto.Cipher.PKCS1_OAEP`    PKCS#1 OAEP encryption, based on RSA key pairs
69==========================    =======================
70
71:undocumented: __revision__, __package__, _AES, _ARC2, _ARC4, _Blowfish
72               _CAST, _DES, _DES3, _XOR
73"""
74
75__all__ = ['AES', 'ARC2', 'ARC4',
76           'Blowfish', 'CAST', 'DES', 'DES3',
77           'XOR',
78           'PKCS1_v1_5', 'PKCS1_OAEP'
79           ]
80
81__revision__ = "$Id$"
82
83