How to write a cipher code
6 views (last 30 days)
Show older comments
Hey I'm very confused right now about cipher code, so can any please explain to me how to write a function that will take "message" as input and give out output as a row of integral.
for example, the message is helllo where h=[1] e=[37] l=[29 31] o=[3]
so the answer become [1 37 29 31 29 3]'
giving that the size of the output is (10x10) matrices and any unused number can be written as -1
I really have no idea how to do this question, I have an attempt by writing function such as
ciphertext=zeros(10,10);
a=double(message);
b=a'
but I think its hopeless,
any advice is appreciated
2 Comments
Jan
on 23 Sep 2013
What is "a row of integral"? Why do you expect a 10x10 matrix as output. How many characters does the inputs have? It looks strange, that some characters have 2 values as enciphered output. 'helo' is an unusual string, do you mean 'hello'? Because you have provide a very lean set of data and no general rule, the suggested methods cannot be powerful.
Walter Roberson
on 23 Sep 2013
Looks like a "box cypher" to me. A text grid is created ahead of time (without knowledge of the message to be sent), and is shared with the destination. Then to encode the message, the sender locates the letters to be transmitted in the grid, records the corresponding index, and crosses out that entry (so it is not reused). The list of indices is transmitted. The receiver looks in their copy of the text box and looks up letter by entry number, reconstructing the grid. If the grid is sufficiently large then the same grid can be used to encode several different messages before it needs to be discarded.
Answers (1)
See Also
Categories
Find more on Encryption / Cryptography in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!