Encryption is a process used in computing and communication. What is its main purpose?
Think about why secret messages are used in spy movies.
Encryption changes readable information into a coded form so only authorized people can read it. This protects privacy and security.
Given the text 'HELLO' and a Caesar cipher that shifts letters by 3 places forward, what is the encrypted output?
def caesar_encrypt(text, shift): result = '' for char in text: if char.isalpha(): shifted = chr((ord(char) - 65 + shift) % 26 + 65) result += shifted else: result += char return result print(caesar_encrypt('HELLO', 3))
Each letter moves 3 places forward in the alphabet. 'H' becomes 'K'.
The Caesar cipher shifts each letter by the given number. 'H' + 3 = 'K', 'E' + 3 = 'H', and so on, resulting in 'KHOOR'.
Which type of encryption uses the same key for both encrypting and decrypting data?
Think about a single key that locks and unlocks a door.
Symmetric encryption uses one key for both encrypting and decrypting. Asymmetric uses two keys (public and private).
Which statement correctly compares encryption and hashing?
Think about whether you can get the original message back.
Encryption can be reversed using a key to get original data. Hashing creates a fixed output that cannot be reversed.
A message of 128 bytes is encrypted using AES with a block size of 16 bytes. What is the length of the encrypted output in bytes?
AES encrypts data in fixed-size blocks. If input fits exactly, output size matches input size.
AES uses 16-byte blocks. 128 bytes is exactly 8 blocks (128/16). No padding needed, so output is 128 bytes.