PageRenderTime 35ms CodeModel.GetById 1ms RepoModel.GetById 0ms 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. """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 Type Description
  34. ======================== ======= ========================
  35. `Crypto.Cipher.AES` Block Advanced Encryption Standard
  36. `Crypto.Cipher.ARC2` Block Alleged RC2
  37. `Crypto.Cipher.ARC4` Stream Alleged RC4
  38. `Crypto.Cipher.Blowfish` Block Blowfish
  39. `Crypto.Cipher.CAST` Block CAST
  40. `Crypto.Cipher.DES` Block 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` Block Triple DES.
  44. `Crypto.Cipher.XOR` Stream 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__, _AES, _ARC2, _ARC4, _Blowfish
  60. _CAST, _DES, _DES3, _XOR
  61. """
  62. __all__ = ['AES', 'ARC2', 'ARC4',
  63. 'Blowfish', 'CAST', 'DES', 'DES3',
  64. 'XOR',
  65. 'PKCS1_v1_5', 'PKCS1_OAEP'
  66. ]
  67. __revision__ = "$Id$"