How to write a cipher code

10 次查看(过去 30 天)
Samious
Samious 2013-9-23
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 个评论
Jan
Jan 2013-9-23
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
Walter Roberson 2013-9-23
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.

请先登录,再进行评论。

回答(1 个)

ES
ES 2013-9-23

类别

Help CenterFile Exchange 中查找有关 Encryption / Cryptography 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by