Theory :
Encryption is the process of converting plain (readable) data into unreadable code to protect it from unauthorized access.
It transforms your data (called plaintext) into ciphertext using an encryption key.
Only someone with the correct decryption key can turn it back into readable form.
Decryption is the reverse process of encryption — it converts the ciphertext back into the original plaintext, using a decryption key.
Application Question :
Encrypt and decrypt HELP
Solution :
Python Code :
Reflection Questions :
Why is the inverse of the key matrix required to be calculated for decryption?
The inverse of the key matrix is required for decryption because it is used to reverse the transformation applied during encryption. In matrix-based encryption methods like the Hill cipher, the ciphertext is generated by multiplying the plaintext vector with the key matrix. To retrieve the original plaintext, we must multiply the ciphertext with the inverse of the key matrix under modular arithmetic.
How does the determinant of a matrix affect its invertibility in modular arithmetic?
In modular arithmetic, a matrix is invertible only if its determinant has a modular inverse (i.e., the determinant and the modulus are coprime). If the determinant is not coprime with the modulus, the matrix does not have an inverse under that modulus, making decryption impossible.
What is the purpose of the adjoint matrix in computing the inverse of the key matrix?
The adjoint matrix is used in the process of computing the inverse of a matrix. In modular arithmetic, the inverse of a matrix is given by the product of the adjoint matrix and the modular inverse of the determinant. The adjoint provides the structure for the inverse, and when scaled by the inverse of the determinant modulo n, it gives the final inverse matrix.
Why do we compute the modular inverse of the determinant when finding the inverse of the key matrix?
The modular inverse of the determinant is necessary because we cannot divide by the determinant directly in modular arithmetic. Instead, we multiply by its modular inverse to scale the adjoint matrix and obtain the inverse matrix. This step ensures that the inverse matrix satisfies the condition A⋅A−1≡I mod n, where A is the key matrix and I is the identity matrix.