필터 지우기
필터 지우기

How to write a cipher code

조회 수: 16 (최근 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