Module symmetric

Module symmetric 

Source
Expand description

various symmetric-key algorithms for the encryption/decryption of digital data

§Introduction

The module that contains a few sub-modules to define symmetric-key algorithms for the encryption/decryption of digital data

§Background: Symmetric encryption/decryption algorithms

There are two caregories in encryption/decryption algorithms: Symmetric-Key cryptographic algorithms and Asymmetric-Key cryptographic algorithms. The Symmetric-Key cryptographic algorithms use the same keys to encrypt and to decrypt, and are way faster than the Symmetric-Key cryptographic algorithms. This module implements a few Symmetric-Key cryptographic algorithms in Rust codes.

Read this article and/or Watch this lecture to learn symmetric encryption/decryption algorithms more in detail.

§The symmetric-key algorithms for the encryption/decryption of digital data

This module provides several kinds of symmetric-key algorithms for the encryption/decryption of digital data:

  • AES and Rijndael symmetric-key encryption/decryption algorithm and the trait implementations of Operation modes and padding bits for AES_Generic — Includes AES and its expanded versions, and ECB, CBC, PCBC, CFB, OFB, and CTR modes, and padding bits according to PKCS#7 and ISO 7816-4. Rijndael_Generic, ECB_PKCS7, ECB_ISO, CBC_PKCS7, CBC_ISO, PCBC_PKCS7, PCBC_ISO, CFB, OFB, and CTR.
  • DES symmetric-key encryption/decryption algorithm and the traits and its implementations of Operation modes and padding bits for DES_Generic — Includes DES and its expanded versions, and ECB, CBC, PCBC, CFB, OFB, and CTR modes, and padding bits according to PKCS#7 and ISO 7816-4. DES_Generic, ECB_PKCS7, ECB_ISO, CBC_PKCS7, CBC_ISO, PCBC_PKCS7, PCBC_ISO, CFB, OFB, and CTR.
  • BigCryptor128 combinations of symmetric-key encryption/decryption algorithms and the trait implementations of Operation modes and padding bits for BigCryptor128 — Includes 2AES, 3AES, 4AES, etc., and their expanded versions, and ECB, CBC, PCBC, CFB, OFB, and CTR modes, and padding bits according to PKCS#7 and ISO 7816-4. BigCryptor128 ECB_PKCS7, ECB_ISO, CBC_PKCS7, CBC_ISO, PCBC_PKCS7, PCBC_ISO, CFB, OFB, and CTR. However, it is considered that 2AES, 3AES, 4AES, etc. are not very meaningful because AES-256, Rijndael_128_384, Rijndael_128_512, etc. are considered to be better than 2AES, 3AES, 4AES, etc.
  • BigCryptor64 combinations of symmetric-key encryption/decryption algorithms and the trait implementations of Operation modes and padding bits for BigCryptor64 — Includes 2DES, 3DES, 4DES, etc., and their expanded versions, and ECB, CBC, PCBC, CFB, OFB, and CTR modes, and padding bits according to PKCS#7 and ISO 7816-4. BigCryptor64 BigCryptor128 ECB_PKCS7, ECB_ISO, CBC_PKCS7, CBC_ISO, PCBC_PKCS7, PCBC_ISO, CFB, OFB, and CTR.

§QUICK START

  • For AES or Rijndael, read here.
  • For DES, read here.
  • For BigCryptor128, read here.
  • For BigCryptor64, read here.

Modules§

documentation
des.rs was too big because of documentation and plenty of examples So, in order to provide documentation without docs.rs’s failing generating documentation, dummy codes were made and documentation and examples were moved to all the *.rs in documentation folder.

Structs§

BigCryptor64
A BigCryptor64 wrapper struct for cascading encryption/decryption algorithms that has 64-bit block size
BigCryptor128
A BigCryptor128 wrapper struct for cascading encryption/decryption algorithms that has 128-bit block size
DDES
struct that generates BigCryptor64 with two DES objects
DES_Generic
A DES symmetric-key algorithm for the encryption of digital data
Rijndael_Generic
A Rijndael or AES (Advanced Encryption Standard) symmetric-key algorithm for the encryption of digital data
TDES
struct that generates BigCryptor64 with three DES objects

Traits§

CBC_ISO
CBC (Cipher-Block Chaining) is one of the operation modes for encryption/decryption. And ISO 7816-4 is the one of the padding ways.
CBC_PKCS7
CBC (Cipher-Block Chaining) is one of the operation modes for encryption/decryption. And PKCS #7 is the one of the padding ways.
CFB
CFB (Cipher FeedBack) is one of the operation modes for encryption/decryption.
CTR
CTR (CounTeR) is one of the operation modes for encryption/decryption.
ECB_ISO
ECB (Electronic CodeBook) is one of the operation modes for encryption/decryption. And ISO 7816-4 is the one of the padding ways.
ECB_PKCS7
ECB (Electronic CodeBook) is one of the operation modes for encryption/decryption. And PKCS #7 is the one of the padding ways.
OFB
OFB (Output FeedBack) is one of the operation modes for encryption/decryption.
PCBC_ISO
PCBC (Propagation Cipher-Block Chaining) is one of the operation modes for encryption/decryption. And ISO 7816-4 is the one of the padding ways.
PCBC_PKCS7
PCBC (Propagation Cipher-Block Chaining) is one of the operation modes forencryption/decryption. And PKCS #7 is the one of the padding ways.
SmallCryptor
SmallCryptor<u64, 8> and SmallCryptor<u128, 16> are the traits for the components for BigCryptor128 and BigCryptor64, respectively.

Type Aliases§

AES_128
AES_128 is one of AES series. Its key is 128-bit and its encryption block is 128-bit. It is the same as the Rijndael_128_128.
AES_192
AES_192 is one of AES series. Its key is 192-bit and its encryption block is 128-bit. It is the same as the Rijndael_128_192.
AES_256
AES_256 is one of AES series. Its key is 256-bit and its encryption block is 128-bit. It is the same as the Rijndael_128_256.
DES
The official DES symmetric-key algorithm for the encryption of digital data If you want to use the official DES algorithm, the type DES is for you.
DES_Expanded
You have freedom of changing ROUND and SHIFT. You can change the DES algorithm by simply changing the generic parameters ROUND and SHIFT without touching the source code itself.
DES_F
You have freedom of changing EP01 ~ EP48, TP01 ~ TP32, and S000 ~ S763. You can change the DES algorithm by simply changing the generic parameters
DES_RoundKey
You have freedom of changing SHIFT, and PC101 ~ PC248. You can change the DES algorithm by simply changing the generic parameters SHIFT, and PC101 ~ PC248 without touching the source code itself.
Rijndael_32_32
Rijndael_32_32 is not really practical but only educational to understand AES or Rijndael cryptographic algorithm. Its key is 32-bit and its encryption block is 32-bit.
Rijndael_64_64
Rijndael_64_64 is not really practical too, but it can be used with DES cryptographic algorithm along or as random number generator engine. Its key is 64-bit and its encryption block is 64-bit. So, it can work with DES.
Rijndael_128_128
Rijndael_128_128 is one of Rijndael series. Its key is 128-bit and its encryption block is 128-bit. It is the same as the AES_128.
Rijndael_128_192
Rijndael_128_192 is one of Rijndael series. Its key is 192-bit and its encryption block is 128-bit. It is the same as the AES_192.
Rijndael_128_256
Rijndael_128_256 is one of Rijndael series. Its key is 256-bit and its encryption block is 128-bit. It is the same as the AES_256.
Rijndael_128_384
Rijndael_128_384 is one of Rijndael series. Its key is 384-bit and its encryption block is 128-bit.
Rijndael_128_512
Rijndael_128_512 can be used as one of post-Quantum algorithms for a while because even Grover algorithm takes long enough to break Rijndael_128_512. Its key is 512-bit and its encryption block is 128-bit.
Rijndael_192_128
Rijndael_256_128 is one of Rijndael series. Its key is 128-bit and its encryption block is 192-bit.
Rijndael_192_192
Rijndael_192_192 is one of Rijndael series. Its key is 192-bit and its encryption block is 192-bit.
Rijndael_192_256
Rijndael_192_256 is one of Rijndael series. Its key is 256-bit and its encryption block is 192-bit.
Rijndael_192_384
Rijndael_192_384 is one of Rijndael series. Its key is 384-bit and its encryption block is 192-bit.
Rijndael_192_512
Rijndael_192_512 can be used as one of post-Quantum algorithms for a while because even Grover algorithm takes long enough to break Rijndael_192_512. Its key is 512-bit and its encryption block is 192-bit.
Rijndael_256_128
Rijndael_256_128 is one of Rijndael series. Its key is 128-bit and its encryption block is 256-bit.
Rijndael_256_192
Rijndael_256_192 is one of Rijndael series. Its key is 192-bit and its encryption block is 256-bit.
Rijndael_256_256
Rijndael_256_256 is one of Rijndael series. Its key is 256-bit and its encryption block is 256-bit.
Rijndael_256_384
Rijndael_256_384 is one of Rijndael series. Its key is 384-bit and its encryption block is 256-bit.
Rijndael_256_512
Rijndael_256_512 can be used as one of post-Quantum algorithms for a while because even Grover algorithm takes long enough to break Rijndael_256_512. Its key is 512-bit and its encryption block is 256-bit.
Rijndael_384_128
Rijndael_384_128 is one of Rijndael series. Its key is 128-bit and its encryption block is 384-bit.
Rijndael_384_192
Rijndael_384_192 is one of Rijndael series. Its key is 192-bit and its encryption block is 384-bit.
Rijndael_384_256
Rijndael_384_256 is one of Rijndael series. Its key is 256-bit and its encryption block is 384-bit.
Rijndael_384_384
Rijndael_384_384 is one of Rijndael series. Its key is 384-bit and its encryption block is 384-bit.
Rijndael_384_512
Rijndael_384_512 can be used as one of post-Quantum algorithms for a while because even Grover algorithm takes long enough to break Rijndael_384_512. Its key is 512-bit and its encryption block is 384-bit.
Rijndael_512_128
Rijndael_512_128 is one of Rijndael series. Its key is 128-bit and its encryption block is 512-bit.
Rijndael_512_192
Rijndael_384_192 is one of Rijndael series. Its key is 192-bit and its encryption block is 512-bit.
Rijndael_512_256
Rijndael_384_256 is one of Rijndael series. Its key is 256-bit and its encryption block is 512-bit.
Rijndael_512_384
Rijndael_512_384 is one of Rijndael series. Its key is 384-bit and its encryption block is 512-bit.
Rijndael_512_512
Rijndael_512_512 can be used as one of post-Quantum algorithms for a while because even Grover algorithm takes long enough to break Rijndael_512_512. Its key is 512-bit and its encryption block is 512-bit.