PageRenderTime 61ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/Crypto/Cipher/__init__.py

https://github.com/andyhhp/pycrypto
Python | 82 lines | 49 code | 1 blank | 32 comment | 1 complexity | aae0b3ec22dd7e86a79ad5fa353d24ba 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. """Symmetric- and asymmetric-key encryption algorithms.
  21. Encryption algorithms transform plaintext in some way that
  22. is dependent on a key or key pair, producing ciphertext.
  23. Symmetric algorithms
  24. --------------------
  25. Encryption can easily be reversed, if (and, hopefully, only if)
  26. one knows the same key.
  27. In other words, sender and receiver share the same key.
  28. The symmetric encryption modules here all support the interface described in PEP
  29. 272, "API for Block Encryption Algorithms".
  30. If you don't know which algorithm to choose, use AES because it's
  31. standard and has undergone a fair bit of examination.
  32. ====================== ====================
  33. Module name Description
  34. ====================== ====================
  35. Crypto.Cipher.AES Advanced Encryption Standard
  36. Crypto.Cipher.ARC2 Alleged RC2
  37. Crypto.Cipher.ARC4 Alleged RC4
  38. Crypto.Cipher.Blowfish Blowfish
  39. Crypto.Cipher.CAST CAST
  40. Crypto.Cipher.DES The Data Encryption Standard.
  41. Very commonly used in the past,
  42. but today its 56-bit keys are too small.
  43. Crypto.Cipher.DES3 Triple DES.
  44. Crypto.Cipher.XOR The simple XOR cipher.
  45. ====================== ====================
  46. Asymmetric algorithms
  47. ---------------------
  48. For asymmetric algorithms, the key to be used for decryption is totally
  49. different and cannot be derived in a feasible way from the key used
  50. for encryption. Put differently, sender and receiver each own one half
  51. of a key pair. The encryption key is often called ``public`` whereas
  52. the decryption key is called ``private``.
  53. ======================== =======================
  54. Module name Description
  55. ======================== =======================
  56. Crypto.Cipher.PKCS1_v1.5 PKCS#1 v1.5 encryption, based on RSA key pairs
  57. Crypto.Cipher.PKCS1_OAEP PKCS#1 OAEP encryption, based on RSA key pairs
  58. ======================== =======================
  59. :undocumented: __revision__, __package__
  60. """
  61. __all__ = ['AES', 'ARC2', 'ARC4',
  62. 'Blowfish', 'CAST', 'DES', 'DES3',
  63. 'XOR',
  64. 'PKCS1_v1_5', 'PKCS1_OAEP'
  65. ]
  66. __revision__ = "$Id$"