Cryptography with A Square Matrix : Encoding - MATLAB Cody - MATLAB Central

Problem 45279. Cryptography with A Square Matrix : Encoding

Difficulty:Rate

Matrix inverse operation can be used to encode or decode of a message. For example

    text = 'matlab & cody'. 

numeric equivalent is

    num = [109 97 116 108 97 98 32 38 32 99 111 100 121]

let

   key = magic(3);

key is an arbitrary square matrix and its inverse is exist.

reshape the vector num so it has the same number of rows with key matrix

   numMatrix = [109 108 32 99 121;
                 97 97 38 111 32;
                116 98 32 100 32];

Note that last two elements are filled with 32 which is the numeric equivalent of blank character ' '.

Finally multiply key with numMatrix (and reshape it) to obtain an encoded vector.

   encodedVector= [1665 1624 1541 1549 1495 1501 486 510 534 1503 1552 1595 1192 747 836]

if you multiply inverse of key with reshaped encodedVector you can obtain the ascii numbers of secret message.

Next Problem : Cryptography with A Square Matrix : Decoding

Inspired from:

Barnett, R.A., Ziegler, M.R. and Byleen, K.E. (2015). Finite Mathematics for Business, Economics, Life Sciences, and Social Sciences. Pearson, 13th (Global) Edition. p:245-247.

Solution Stats

36.36% Correct | 63.64% Incorrect
Last Solution submitted on Dec 28, 2022

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Problem Recent Solvers10

Suggested Problems

More from this Author92

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!