[Back] In the early 1970s, IBM patented the Lucifer cipher and which was then used by Lloyds Bank within some of the first ATM cash dispensers. After an evaluation by the NSA, Lucifer’s key size was reduced from 112 bits to 56 bits, after which it was published as the DES standard in 1975. DES then became manditory within its usage within US government electronic fund transfers, and went on to became a de-factor interational standard. DES has a 64-bit key size (of which only 56 bits of the key are used for the encryption process), and a 64-bit block size.
# https://asecuritysite.com/encryption/aes_modes from Crypto.Cipher import DES import hashlib import sys import binascii import Padding msg='hello' password='hello' ival=10 if (len(sys.argv)>1): msg=sys.argv if (len(sys.argv)>2): password=str(sys.argv) if (len(sys.argv)>3): ival=int(sys.argv) plaintext=msg def encrypt(plaintext,key, mode): encobj = DES.new(key,mode) return(encobj.encrypt(plaintext)) def decrypt(ciphertext,key, mode): encobj = DES.new(key,mode) return(encobj.decrypt(ciphertext)) key = hashlib.sha256(password.encode()).digest()[:8] plaintext = Padding.appendPadding(plaintext,blocksize=Padding.DES_blocksize,mode=0) print ("Input data (CMS): "+binascii.hexlify(plaintext.encode()).decode()) ciphertext = encrypt(plaintext.encode(),key,DES.MODE_ECB) print ("Cipher (ECB): "+binascii.hexlify(bytearray(ciphertext)).decode()) plaintext = decrypt(ciphertext,key,DES.MODE_ECB) plaintext = Padding.removePadding(plaintext.decode(),mode=0) print (" decrypt: "+plaintext)