In cryptography, symmetric key is used to encrypt and decrypt with the same key.
Principles
Block size. Block. A block cipher uses a block size of a given number of bits. DES has a 64-bit block size, and AES has a 128-bit block size.
Padding in Go. Padding. Block ciphers have a defined block size, such as a 64-bit block size in DES, and a 128-bit block size for AES. As the data will not fill all the blocks, we need to pad before encryption, and then unpad after decryption.
Padding (AES). Padding. This outlines how data is padded for AES.
Padding (DES). Padding. This outlines how data is padded for DES.
Padding (DES) with CBC. Padding. This outlines how data is padded for DES for CBC.
SSL. SSL. This outlines the debug information returned from an SSL/TLS connection.
Range of methods. OpenSSL. This includes the encryption of a wide range of methods.
Hazmat Symmetric Key. Symmetric key. This includes the encryption of a wide range of methods implemented with Hazmat.
Key Wrap
Key Wrap. Key Wrap. This wraps an encryption for so that it can be protected, and also checked for integrity.
Key Wrap using a password. Key Wrap with a password. We can create a master key from a pasword, and then use this to protect an existing data encryption key. The master key will be derived from PBKDF2, as we would use with TrueCrypt.
AES (Python) with OpenSSL format. AES. This implements AES using Python for CBC and with an OpenSSL output.
AES (Python). AES. This implements AES using Python for a number of AES modes.
AES GCM Mode (Python). AES GCM (Python). This implements AES using Python for GCM mode. GCM mode does not require padding and is a stream cipher. It also has integrated authentication.
AES GCM Mode (Python) with PBKDF2. AES GCM (Python) with PBKDF2. This implements AES using Python for GCM mode. GCM mode does not require padding and is a stream cipher. It also has integrated authentication.
AES GCM Mode (Golang). AES GCM (Golang). This implements AES using Golang for GCM mode.
AES. AES. AES (or Rijndael) is a new block cipher, and is the new replacement for DES, and uses 128-bit blocks with 128, 192 and 256-bit encryption keys. It was selected by NIST in 2001 (after a five-year standardisation process). The name Rijndael comes from its Belgium creators: Joan Daemen and Vincent Rijmen.
C# AES and OpenSSL. Csharp for OpenSSL. This produces the same AES CBC output for C# as for OpenSSL.
3DES (with clear text keys). 3DES. This example generates the 3DES key clear text keys.
3DES. 3DES. DES encryption algorithm is block cipher and uses a 64-bit block and a 64-bit encryption key (of which only 56 bits are actively used in the encryption process). Unfortunately, DES has been around for a long time, and the 56-bit version is now easily crackable (in less than a day, on fairly modest equipment). An enhancement, and one which is still fairly compatible with DES, is the 3-DES algorithm. It has three phases and splits the key into two. Overall the key size is typically 112 bits (2x54 bits - with a combination of the three keys - of which two of the keys are typically the same). The algorithm is EncryptK3( DecryptK2( EncryptK1(message), where K1 and K3 are typically the same (to keep compatibility).
All-or-nothing. AONT. The All-or-nothing created messages, of which all the messages are required to rebuild the original message.
Blowfish (with CBC). Blowfishcbc. With CBC we split the message into blocks and encrypt each block. The input from the first stage is the IV (Initialisation Vector), and the input to the following stages is the output from the previous stage. In this example we will use Blowfish to encrypt, using CBC.
Blowfish. Blowfish. Bruce Schneier created Blowfish with a general-purpose private key block cipher encryption algorithm.
Camellia. Camellia. Camillia is a block cipher created by Mitsubishi and NTT.
Commutative encryption with Go. Comm. With commutative encryption we can encrypt and decrypt in any order.
DES (Python). DES. DES encryption algorithm is block cipher and uses a 64-bit block and a 64-bit encryption key. This example shows some Python code.
DES. DES. DES encryption algorithm is block cipher and uses a 64-bit block and a 64-bit encryption key.
Feistel Ciphers. Feistel Ciphers. This provides an implementation of a Feistel Cipher.
Pohlig-Hellman. Pohlig. This uses the Pohlig-Hellman algorithm.
RC2. RC2. RC2 ("Rivest Cipher") is a block cipher and is seen as a replacement for DES. It was created by Ron Rivest in 1987, and is a 64-bit block code and can have a key size from 40 bits to 128-bits (in increments of 8 bits). The 40-bit key version is seen as weak, as the encryption key is so small, but is favoured by governments for export purposes, as it can be easily cracked. In this case, the key is created from a Key and an IV (Initialisation Vector). The key has 12 characters (96 bits), and the IV has 8 characters (64 bits), which go to make the overall key.
RC5. RC5. RC5 is a block cipher with variable key size, block size and rounds.
RC6. RC6. RC6 is a block cipher with variable key size, block size and rounds.
Red Pike. Red Pike. This provides an implementation of Red Pike.
Serpent in Go. Serpent. Serpent symmetric key encryption method.
Skipjack. Skip jack. Skipjack is a block cipher, using private-key encryption algorithm, and designed by NSA.
Twofish. Twofish. Bruce Schneier created Twofish with a general-purpose private key block cipher encryption algorithm.
Stream ciphers
Affine. Affine. Affine is a stream cipher which uses an equation to encrypt.
ARIA. ARIA. ARIA is a stream cipher and has a similar operation to AES but has two S-boxes.
ChaCha20. ChaCha20. ChaCha is a stream cipher and is three-times faster than AES.
ChaCha20 and Poly1305. ChaCha. ChaCha20 and Poly1305.
ChaCha20 in node.js. ChaCha20. Implements ChaCha20 in node.js.
ChaCha20. ChaCha20. This involves creating the ChaCha20 key stream cipher.
RC4. RC4. RC4 is a stream cipher used in WEP (in wireless encryption).
RC4 (repeating IV). RC4. This illustrates how we can EX-OR two values with the same IV value.
RC4 key generation. RC4. This illustrates how we generate the key.
Salsa20. Salsa20. Salsa20 is a stream cipher and is three-times faster than AES.
Secret-key encryption methods (Hybrid)
The following are the tips related to encryption:
IES (Integrated Encryption Scheme) - Discrete Logs. IES. This example generates a symmetric key using public key encryption. This method uses discrete logarithms.
IES (Integrated Encryption Scheme)- Elliptic Curve. IES. This example generates a symmetric key using public key encryption. This method uses elliptic curves.
Google Tink (Hybrid Encryption). Google Tink (Hybrid Encryption). This outlines the integration of hybrid encryption into Google Tink
Elliptic Curve Integrated Encryption Scheme (ECIES with AES Encryption). Elliptic Curve (Encryption). Elliptic Curv is a public key method. This page outlines how we can use it to encrypt with AES.
ECIES. ECIES. Create encryption with elliptic curve to generate a key pair and AES to encrypt.
NHSX Contract Tracing with ECIES. NHSX. Create encryption with elliptic curve to generate a key pair and AES to encrypt
Encryption cracking (AES)
AES Crack (Brute force). AES. This outlines of the cracking of AES with common passwords.
AES Crack (Copy-and-paste). AES. This outlines of the cracking of AES with copy-and-paste attacks.
AES Crack (Non-random numbers). AES. This outlines of the cracking of AES with non-random numbers.
Cracking RSA with Chinese Remainder Theory (with different primes). RSA. This outlines of the cracking of RSA with Chinese Remainder Theorem with varying prime numbers and an ASCII string.
Differential Cryptanalysis (AES CBC). Cryptanalysis (AES CBC). This provides an implementation of differential cryptanalysis for the AES cipher within CBC mode.
Differential Cryptanalysis (AES CFB). Cryptanalysis (AES CFB). This provides an implementation of differential cryptanalysis for the AES cipher within CFB mode (converts to a stream cipher, so no need for padding).
Differential Cryptanalysis (AES CTR). Cryptanalysis (AES CTR). This provides an implementation of differential cryptanalysis for the AES cipher within CTR mode (converts to a stream cipher, so no need for padding).
Differential Cryptanalysis (AES ECB). Cryptanalysis (AES ECB). This provides an implementation of differential cryptanalysis for the AES cipher within ECB mode.