Single DES — PyCryptodome 3.210b0 documentation (2024)

Warning

Use AES instead. This module is provided only for legacy purposes.

DES (Data Encryption Standard) is a symmetric block cipher standardizedin FIPS 46-3(now withdrawn).It has a fixed data block size of 8 bytes.

Its keys are 64 bits long, even though 8 bits were used for integrity (now theyare ignored) and do not contribute to security. The effective key length istherefore 56 bits only.

DES was never cryptographically broken, but its key length is too short by nowadaysstandards and it could be brute forced with some effort.

As an example, encryption can be done as follows:

>>> from Crypto.Cipher import DES>>>>>> key = b'-8B key-'>>> cipher = DES.new(key, DES.MODE_OFB)>>> plaintext = b'sona si latine loqueris '>>> msg = cipher.iv + cipher.encrypt(plaintext)

Module’s constants for the modes of operation supported with Single DES:

var MODE_ECB:

Electronic Code Book (ECB)

var MODE_CBC:

Cipher-Block Chaining (CBC)

var MODE_CFB:

Cipher FeedBack (CFB)

var MODE_OFB:

Output FeedBack (OFB)

var MODE_CTR:

CounTer Mode (CTR)

var MODE_OPENPGP:

OpenPGP Mode

var MODE_EAX:

EAX Mode

Crypto.Cipher.DES.new(key, mode, *args, **kwargs)

Create a new DES cipher.

Parameters:
  • key (bytes/bytearray/memoryview) – The secret key to use in the symmetric cipher.It must be 8 byte long. The parity bits will be ignored.

  • mode (One of the supported MODE_* constants) – The chaining mode to use for encryption or decryption.

Keyword Arguments:
  • iv (byte string) –(Only applicable for MODE_CBC, MODE_CFB, MODE_OFB,and MODE_OPENPGP modes).

    The initialization vector to use for encryption or decryption.

    For MODE_CBC, MODE_CFB, and MODE_OFB it must be 8 bytes long.

    For MODE_OPENPGP mode only,it must be 8 bytes long for encryptionand 10 bytes for decryption (in the latter case, it isactually the encrypted IV which was prefixed to the ciphertext).

    If not provided, a random byte string is generated (you must thenread its value with the iv attribute).

  • nonce (byte string) –(Only applicable for MODE_EAX and MODE_CTR).

    A value that must never be reused for any other encryption donewith this key.

    For MODE_EAX there are norestrictions on its length (recommended: 16 bytes).

    For MODE_CTR, its length must be in the range [0..7].

    If not provided for MODE_EAX, a random byte string is generated (youcan read it back via the nonce attribute).

  • segment_size (integer) –(Only MODE_CFB).The number of bits the plaintext and ciphertextare segmented in. It must be a multiple of 8.If not specified, it will be assumed to be 8.

  • mac_len : (integer) –(Only MODE_EAX)Length of the authentication tag, in bytes.It must be no longer than 8 (default).

  • initial_value : (integer) –(Only MODE_CTR). The initial value for the counter withinthe counter block. By default it is 0.

Return:

a DES object, of the applicable mode.

Single DES — PyCryptodome 3.210b0 documentation (2024)
Top Articles
Infinite Tsukuyomi
Top Rated Credit Repair Service | Credit Glory
Whas Golf Card
Jail Inquiry | Polk County Sheriff's Office
Poe T4 Aisling
Fort Carson Cif Phone Number
Nfr Daysheet
Get train & bus departures - Android
Fusion
Dr Lisa Jones Dvm Married
Calamity Hallowed Ore
Irving Hac
Magic Mike's Last Dance Showtimes Near Marcus Cedar Creek Cinema
Crusader Kings 3 Workshop
Nashville Predators Wiki
Craigslist Deming
Sand Castle Parents Guide
Are They Not Beautiful Wowhead
Munich residents spend the most online for food
How to Create Your Very Own Crossword Puzzle
Craigslistjaxfl
Ruben van Bommel: diepgang en doelgerichtheid als wapens, maar (nog) te weinig rendement
Trivago Sf
Delaware Skip The Games
Conan Exiles Sorcery Guide – How To Learn, Cast & Unlock Spells
Somewhere In Queens Showtimes Near The Maple Theater
Www.patientnotebook/Atic
Talk To Me Showtimes Near Marcus Valley Grand Cinema
Dewalt vs Milwaukee: Comparing Top Power Tool Brands - EXTOL
Dark Entreaty Ffxiv
27 Modern Dining Room Ideas You'll Want to Try ASAP
NV Energy issues outage watch for South Carson City, Genoa and Glenbrook
Login.castlebranch.com
Craigslist Efficiency For Rent Hialeah
Delta Rastrear Vuelo
Xfinity Outage Map Lacey Wa
Frostbite Blaster
The best Verizon phones for 2024
Sam's Club Gas Prices Florence Sc
Panorama Charter Portal
Trivago Anaheim California
Az Unblocked Games: Complete with ease | airSlate SignNow
Fluffy Jacket Walmart
Kaamel Hasaun Wikipedia
855-539-4712
Race Deepwoken
10 Best Tips To Implement Successful App Store Optimization in 2024
Diccionario De Los Sueños Misabueso
Hsi Delphi Forum
Booked On The Bayou Houma 2023
Latest Posts
Article information

Author: Kieth Sipes

Last Updated:

Views: 6196

Rating: 4.7 / 5 (67 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Kieth Sipes

Birthday: 2001-04-14

Address: Suite 492 62479 Champlin Loop, South Catrice, MS 57271

Phone: +9663362133320

Job: District Sales Analyst

Hobby: Digital arts, Dance, Ghost hunting, Worldbuilding, Kayaking, Table tennis, 3D printing

Introduction: My name is Kieth Sipes, I am a zany, rich, courageous, powerful, faithful, jolly, excited person who loves writing and wants to share my knowledge and understanding with you.