Skip to main content

Crate tc_des

Crate tc_des 

Source
Expand description

Data Encryption Standard (DES) and Triple DES implementations.

These algorithms are retained for compatibility with legacy protocols and are not suitable for new designs.

§Choosing an engine

DesEngine and DesEdeEngine pick an engine at compile time: the RustCrypto engines when the rustcrypto Cargo feature is enabled, otherwise DesTableEngine and DesEdeTableEngine. Every engine is variable time, since each looks up S-boxes with secret data; the RustCrypto engines narrow the cache-timing channel with smaller S-boxes and a branch-free key schedule. For explicit selection, DesRustCryptoEngine and DesEdeRustCryptoEngine are available with the rustcrypto feature.

Structs§

DesEdeEngine
EDE Triple DES on the least leaky engine the build provides: DesEdeRustCryptoEngine when the rustcrypto feature is on, otherwise DesEdeTableEngine. The choice is made at compile time; the type and its API are the same under every configuration.
DesEdeRustCryptoEngine
EDE Triple DES backed by RustCrypto’s des crate, with a 16-byte or 24-byte encoded key and an 8-byte block.
DesEdeTableEngine
EDE Triple DES with a 16-byte or 24-byte encoded key and an 8-byte block, using the same SP-box tables as DesTableEngine.
DesEngine
DES on the least leaky engine the build provides: DesRustCryptoEngine when the rustcrypto feature is on, otherwise DesTableEngine. The choice is made at compile time; the type and its API are the same under every configuration.
DesRustCryptoEngine
DES backed by RustCrypto’s des crate, with an 8-byte encoded key and an 8-byte block.
DesTableEngine
DES with an 8-byte encoded key and an 8-byte block, using eight 256-byte SP-box tables that combine each S-box with the P permutation.

Constants§

BLOCK_BYTES
DES and Triple DES block length in bytes.
DES_ALGO_NAME
Algorithm name returned by every DES engine’s Display implementation.
DES_EDE_ALGO_NAME
Algorithm name returned by every Triple DES engine’s Display implementation.
DES_EDE_KEY_BYTES
Accepted Triple DES key lengths in bytes.
DES_KEY_BYTES
Accepted DES key lengths in bytes: 64 encoded bits, 56 of them effective.
EDE2_KEY_BYTES
Encoded key length for two-key Triple DES (K1, K2, K1).
EDE3_KEY_BYTES
Encoded key length for three-key Triple DES (K1, K2, K3).