passlib.utils.des
 DES routines [deprecated]¶
Warning
This module is deprecated as of Passlib 1.7:
It has been relocated to passlib.crypto.des
;
and the aliases here will be removed in Passlib 2.0.
This module contains routines for encrypting blocks of data using the DES algorithm.
Note that these functions do not support multiblock operation or decryption,
since they are designed primarily for use in password hash algorithms
(such as des_crypt
and bsdi_crypt
).

passlib.utils.des.
expand_des_key
(*args, **kwds)¶ convert DES from 7 bytes to 8 bytes (by inserting empty parity bits)
Deprecated since version 1.7: and will be removed in version 1.8, use passlib.crypto.des.expand_des_key instead.

passlib.utils.des.
des_encrypt_block
(*args, **kwds)¶ encrypt single block of data using DES, operates on 8byte strings.
arg key: DES key as 7 byte string, or 8 byte string with parity bits (parity bit values are ignored). arg input: plaintext block to encrypt, as 8 byte string. arg salt: Optional 24bit integer used to mutate the base DES algorithm in a manner specific to des_crypt
and its variants. The default value0
provides the normal (unsalted) DES behavior. The salt functions as follows: if thei
‘th bit ofsalt
is set, bitsi
andi+24
are swapped in the DES Ebox output.arg rounds: Optional number of rounds of to apply the DES key schedule. the default ( rounds=1
) provides the normal DES behavior, butdes_crypt
and its variants use alternate rounds values.raises TypeError: if any of the provided args are of the wrong type. raises ValueError: if any of the input blocks are the wrong size, or the salt/rounds values are out of range. returns: resulting 8byte ciphertext block. Deprecated since version 1.7: and will be removed in version 1.8, use passlib.crypto.des.des_encrypt_block instead.

passlib.utils.des.
des_encrypt_int_block
(*args, **kwds)¶ encrypt single block of data using DES, operates on 64bit integers.
this function is essentially the same as
des_encrypt_block()
, except that it operates on integers, and will NOT automatically expand 56bit keys if provided (since there’s no way to detect them).arg key: DES key as 64bit integer (the parity bits are ignored). arg input: input block as 64bit integer arg salt: optional 24bit integer used to mutate the base DES algorithm. defaults to 0
(no mutation applied).arg rounds: optional number of rounds of to apply the DES key schedule. defaults to 1
.raises TypeError: if any of the provided args are of the wrong type. raises ValueError: if any of the input blocks are the wrong size, or the salt/rounds values are out of range. returns: resulting ciphertext as 64bit integer. Deprecated since version 1.7: and will be removed in version 1.8, use passlib.crypto.des.des_encrypt_int_block instead.