| 1 |
Single DES |
| 2 |
========== |
| 3 |
|
| 4 |
.. warning:: |
| 5 |
Use :doc:`aes` instead. This module is provided only for legacy purposes. |
| 6 |
|
| 7 |
DES `(Data Encryption Standard)`__ is a symmetric block cipher standardized |
| 8 |
in `FIPS 46-3 <http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf>`_ |
| 9 |
(now withdrawn). |
| 10 |
It has a fixed data block size of 8 bytes. |
| 11 |
|
| 12 |
Its keys are 64 bits long, even though 8 bits were used for integrity (now they |
| 13 |
are ignored) and do not contribute to security. The effective key length is |
| 14 |
therefore 56 bits only. |
| 15 |
|
| 16 |
DES was never cryptographically broken, but its key length is too short by nowadays |
| 17 |
standards and it could be brute forced with some effort. |
| 18 |
|
| 19 |
As an example, encryption can be done as follows: |
| 20 |
|
| 21 |
>>> from Crypto.Cipher import DES |
| 22 |
>>> |
| 23 |
>>> key = b'-8B key-' |
| 24 |
>>> cipher = DES.new(key, DES.MODE_OFB) |
| 25 |
>>> plaintext = b'sona si latine loqueris ' |
| 26 |
>>> msg = cipher.iv + cipher.encrypt(plaintext) |
| 27 |
|
| 28 |
.. __: http://en.wikipedia.org/wiki/Data_Encryption_Standard |
| 29 |
|
| 30 |
.. automodule:: Crypto.Cipher.DES |
| 31 |
:members: |