(New page: == Part 1 == Bob can decrypt the message by multiplying the message he receives by the inverse of the encryption matrix == Part 2 == Well eve could always do a left matrix divide of the...) |
|||
Line 8: | Line 8: | ||
== Part 3 == | == Part 3 == | ||
+ | |||
+ | The Decrypted matrix ends up being [2 23 5] | ||
+ | |||
+ | |||
<pre> | <pre> | ||
% input original message sent | % input original message sent |
Latest revision as of 06:19, 19 September 2008
Part 1
Bob can decrypt the message by multiplying the message he receives by the inverse of the encryption matrix
Part 2
Well eve could always do a left matrix divide of the (encryption matrix) \ (encrypted message) but that is the same as the inverse(encryption matrix) * (encrypted message). So Eve would most likely have to take the inverse of the matrix.
Part 3
The Decrypted matrix ends up being [2 23 5]
% input original message sent message = [1 0 1;0 1 0;4 0 1] % input encrypted matrix that corresponds to the original message encryptMes = [2 0 0; 0 1 0; 0 0 3] % input message that you want to decrypt EncryptedMessage = [2;23;3] % find what matrix is used to encrypt the message by taking the encrypted % message and multiplying by the inverse of the message EncryptionMatrix = encryptMes*inv(message) % Take the inverse of the matrix used to encrypt the original message so % that you can work backwards from and encrypted message to original % message InvEncryptionMatrix = inv(EncryptionMatrix) % Decrypt the message by multiplying the inverse of the encryption matrix % by the encrypted message. Should leave you with the original decrypted % message. DecryptedMessage = InvEncryptionMatrix*EncryptedMessage % Display of output for function... % message = % % 1 0 1 % 0 1 0 % 4 0 1 % % % encryptMes = % % 2 0 0 % 0 1 0 % 0 0 3 % % % EncryptedMessage = % % 2 % 23 % 3 % % % EncryptionMatrix = % % -0.6667 0 0.6667 % 0 1.0000 0 % 4.0000 0 -1.0000 % % % InvEncryptionMatrix = % % 0.5000 0 0.3333 % 0 1.0000 0 % 2.0000 0 0.3333 % % % DecryptedMessage = % % 2 % 23 % 5