AES

Definition

AES (Advanced Encryption Standard) is a symmetric encryption algorithm widely used across the globe to secure data. It operates on fixed block sizes of 128 bits and supports key lengths of 128, 192, or 256 bits, providing a robust level of security. AES is known for its speed and efficiency in both hardware and software implementations, making it a preferred choice for encrypting sensitive information.

Secure Settings Example

from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes

key = get_random_bytes(32)  # 256-bit key for AES-256
cipher = AES.new(key, AES.MODE_GCM)  # GCM mode for authenticated encryption
nonce = cipher.nonce
data = b'Secret Data'
ciphertext, tag = cipher.encrypt_and_digest(data)

# Store nonce, ciphertext, and tag securely

Insecure Settings Example

from Crypto.Cipher import AES

key = b'1234567890123456'  # Weak 128-bit key
cipher = AES.new(key, AES.MODE_ECB)  # ECB mode is insecure
data = b'Secret Data'
ciphertext = cipher.encrypt(data)

# ECB mode does not provide data integrity or confidentiality