Danger

This is a “Hazardous Materials” module. You should ONLY use it if you’re 100% absolutely sure that you know what you’re doing because this module is full of land mines, dragons, and dinosaurs with laser guns.

# Decrepit Symmetric algorithms

This module contains decrepit symmetric encryption algorithms. These are algorithms that should not be used unless necessary for backwards compatibility or interoperability with legacy systems. Their use is strongly discouraged.

These algorithms require you to use a `Cipher` object along with the appropriate `modes`.

class cryptography.hazmat.decrepit.ciphers.algorithms.ARC4(key)

  Added in version 43.0.0.

  ARC4 (Alleged RC4) is a stream cipher with serious weaknesses in its initial stream output. Its use is strongly discouraged. ARC4 does not use mode constructions.

  Parameters:

    key (bytes-like) – The secret key. This must be kept secret. Either `40`, `56`, `64`, `80`, `128`, `192`, or `256` bits in length.

      >>> import os
      >>> from cryptography.hazmat.decrepit.ciphers.algorithms import ARC4
      >>> from cryptography.hazmat.primitives.ciphers import Cipher, modes
      >>> key = os.urandom(16)
      >>> algorithm = ARC4(key)
      >>> cipher = Cipher(algorithm, mode=None)
      >>> encryptor = cipher.encryptor()
      >>> ct = encryptor.update(b"a secret message")
      >>> decryptor = cipher.decryptor()
      >>> decryptor.update(ct)
      b'a secret message'

class cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES(key)

  Added in version 43.0.0.

  Triple DES (Data Encryption Standard), sometimes referred to as 3DES, is a block cipher standardized by NIST. Triple DES has known crypto-analytic flaws, however none of them currently enable a practical attack. Nonetheless, Triple DES is not recommended for new applications because it is incredibly slow; old applications should consider moving away from it.

  Parameters:

    key (bytes-like) – The secret key. This must be kept secret. Either `64`, `128`, or `192` bits long. DES only uses `56`, `112`, or `168` bits of the key as there is a parity byte in each component of the key. Some writing refers to there being up to three separate keys that are each `56` bits long, they can simply be concatenated to produce the full key.

class cryptography.hazmat.decrepit.ciphers.algorithms.CAST5(key)

  Added in version 43.0.0.

  CAST5 (also known as CAST-128) is a block cipher approved for use in the Canadian government by the Communications Security Establishment. It is a variable key length cipher and supports keys from 40-128 bits in length.

  Parameters:

    key (bytes-like) – The secret key, This must be kept secret. 40 to 128 bits in length in increments of 8 bits.

      >>> import os
      >>> from cryptography.hazmat.decrepit.ciphers.algorithms import CAST5
      >>> from cryptography.hazmat.primitives.ciphers import Cipher, modes
      >>> key = os.urandom(16)
      >>> iv = os.urandom(8)
      >>> algorithm = CAST5(key)
      >>> cipher = Cipher(algorithm, modes.CBC(iv))
      >>> encryptor = cipher.encryptor()
      >>> ct = encryptor.update(b"a secret message")
      >>> decryptor = cipher.decryptor()
      >>> decryptor.update(ct)
      b'a secret message'

class cryptography.hazmat.decrepit.ciphers.algorithms.SEED(key)

  Added in version 43.0.0.

  SEED is a block cipher developed by the Korea Information Security Agency (KISA). It is defined in RFC 4269 and is used broadly throughout South Korean industry, but rarely found elsewhere.

  Parameters:

    key (bytes-like) – The secret key. This must be kept secret. `128` bits in length.

class cryptography.hazmat.decrepit.ciphers.algorithms.Blowfish(key)

  Added in version 43.0.0.

  Blowfish is a block cipher developed by Bruce Schneier. It is known to be susceptible to attacks when using weak keys. The author has recommended that users of Blowfish move to newer algorithms.

  Parameters:

    key (bytes-like) – The secret key. This must be kept secret. 32 to 448 bits in length in increments of 8 bits.

class cryptography.hazmat.decrepit.ciphers.algorithms.IDEA(key)

  Added in version 43.0.0.

  IDEA (International Data Encryption Algorithm) is a block cipher created in 1991. It is an optional component of the OpenPGP standard. This cipher is susceptible to attacks when using weak keys. It is recommended that you do not use this cipher for new applications.

  Parameters:

    key (bytes-like) – The secret key. This must be kept secret. `128` bits in length.