Creating a Challenging Code with Simple Techniques

  • Thread starter Thread starter dusty8683
  • Start date Start date
  • Tags Tags
    Code
Click For Summary
The discussion revolves around creating complex codes for messages to prevent easy deciphering. One user shares their experience of using a polynomial function to encode letters, but they seek advice on making their code more secure. Suggestions include employing various encryption methods, such as RSA, and using frequency analysis to complicate cracking attempts. Several participants propose advanced techniques like utilizing random number generators, creating unique number assignments for letters, and employing the Vigenère cipher with long, random keys to enhance security. The conversation also touches on the limitations of certain mathematical approaches, such as using imaginary numbers in encryption, and emphasizes the importance of avoiding predictable patterns in codes. Overall, the thread highlights the creativity and complexity involved in cryptography, with users sharing insights and resources for further learning.
  • #31
Set yourself up a square matrix that has a determinant of 1 (that way, it's inverse will be all integers, as well). A larger matrix is harder to crack but also harder to construct. Code your letters as A=1, B=2, C=3, etc. Cycle them through by a set number each time. (If you're using a 5 x 5 matrix, cycle in 5 letters to make a 5 x1 matrix, for example). Multiply your encoding matrix by the sequence of letters you're encoding. Your message is coded.

To decode, mutliply the inverse of your matrix by the coded letters (5 at a time if you're using 5x5 matrix, 6 if you're using 6x6, etc).

As a simple example, using a 3 x 3 matrix:

\left(\begin{array}{ccc}3&4&2\\5&3&8\\4&5&3\end{array}\right)

Encode A, B, C where A=1, B=2, C=3 by multiplying

\left(\begin{array}{ccc}3&4&2\\5&3&8\\4&5&3\end{array}\right)\ast\left(\begin{array}{c}1\\2\\3\end{array}\right) = \left(\begin{array}{c}17\\35\\23\end{array}\right)

To decode, multiply the inverse of your encoder matrix by the coded text:

\left(\begin{array}{ccc}-31&-2&26\\17&1&-14\\13&1&-11\end{array}\right)\ast\left(\begin{array}{c}17\\35\\32\end{array}\right) = \left(\begin{array}{c}1\\2\\3\end{array}\right)

Obviously, you'd want to use a larger matrix than just a 3x3. With a 3x3 matrix, 1/3 of all your 'the's would be encrypted together, making it pretty easy to spot them. Once a person decrypted the word 'the', they'd have the whole key and could figure out the rest of the message.
 
Last edited:
Physics news on Phys.org
  • #33
Neat ! Never seen this before. Also, this is the first time that I've seen the i'th ciphertext character be a function of more than just the i'th plaintext character (and elements of a key).
 
  • #34
Gokul43201 said:
The problem with a 'code' would have to be the size of the key. I know codes were used in medieval times. Something like a code (actually, just a refined translation) was used by the Navajo Windtalkers in the Pacific Theater during WWII. This is probably talked about in the Code Book - can't remember, it's been a while since I read it.

There is no algorithm for cracking a code where each word is replaced by a specific word (except possibly, for articles, conjunctions, etc - which may be avoided or minimized). There will be repetitions only if a word is repeated. To crack a code like that would possibly need some knowledge of context. Sheer, brte force analysis, won't really work. You'll have to use tricks like the Brits did to crack Enigma...like leaking seed info and looking for it in transmissions.

Yes it did mention the navajos, i see what you meen, i got them in some spam messages i was reading (not the smartest thing i know lol) so it's not really important that i know or anything, and i don't think i would make a very good spy with a broken leg lol so i guess that's it.

Adam
 
  • #35
After playing with the matrices a little, I decided it's not that easy to construct a good matrix (but I've almost never had to deal with matrices bigger than 3x3). The format the SOS page used gave me an easier idea.

Rather than mess around with bigger matrices, you can vertically encode the text during encryption to get rid of the patterns.

Your text is arranged in frames and superframes. Each frame can be any number of letters long (I used 15 - that seemed long enough). Each superframe is 3 frames long.

The text is entered sequentially in each frame (horizontally), wrapping around to the next frame when the end of one is reached (just like reaching the end of a line). When encrypting, the entire superframe is encrypted vertically (with a 15 character frame, that means characters 1, 16, and 31 are encrypted together; 2, 17, and 32 are encrypted together; 3, 18, and 33 are encrypted together; etc). With a 15 character frame, the entire message winds up being sent in 45 character blocks. That eliminates your patterns, at least good enough for amateur purposes.
 
  • #36
To get a matrix with determinant 1, just perform elementary row and column operations on any upper triangular matrix with all entries in the main diagonal 1. So start with [[1,a,b,...][0,1,c,d,...][0,0,1,e,f,...]...] and manipulate it until its sufficiently mixed up.

cookiemonster
 
  • #37
One of the main problems with codes is that you cannot memorized a code book. You must keep it on hand. If your name is 007, you cannot afford to be caught with the book because it will give away your profession, and if the book is discovered, there is little problem in decoding your messages. One can avoid some of the problems by using a commonly available text, A Jules Verne story for example. Then you can use the page number and a word count on that page to pick out the desired word, but the content of your message is limited to the vocabulary of the code book. If, for example, your book has an excellent vocabulary of electronic terms, what do you do when you must discuss a medical or chemical problem?
The 'Beale Ciphers' written back in 1885 sidestepped some of these problems by using the Declaration of Independence as the key document. The cipher then used the page number and a character count on that page to indicate the enciphered character. Unfortunately, the enciphered message was much longer than the original; however, it was a pretty effective system, only one of three messages shown could be deciphered.

In the end, the real challenge is in cracking the ciphers rather than writing them.
 
  • #38
I had mentioned the Beale treasure to the dowsers/diviners over at Skepticism & Debunking. They were not especially interested.

And I think, 2 of the 3 Beale letters were cracked. Only the last one, giving the location of the treasure, remains unsolved.
 
  • #39
Pfft said:
One of the main problems with codes is that you cannot memorized a code book. You must keep it on hand. If your name is 007, you cannot afford to be caught with the book because it will give away your profession, and if the book is discovered, there is little problem in decoding your messages. One can avoid some of the problems by using a commonly available text, A Jules Verne story for example. Then you can use the page number and a word count on that page to pick out the desired word, but the content of your message is limited to the vocabulary of the code book. If, for example, your book has an excellent vocabulary of electronic terms, what do you do when you must discuss a medical or chemical problem?
The 'Beale Ciphers' written back in 1885 sidestepped some of these problems by using the Declaration of Independence as the key document. The cipher then used the page number and a character count on that page to indicate the enciphered character. Unfortunately, the enciphered message was much longer than the original; however, it was a pretty effective system, only one of three messages shown could be deciphered.

In the end, the real challenge is in cracking the ciphers rather than writing them.

Ya but writing ciphers is more fun lol

Adam
 
  • #40
you should take the code, and multiply 3 #'s at a time into a 3 by 3 matrix of fractions, then put all the #'s in reverse order. If he get's that one, he's a genius


~wannabe genius
 
  • #41
@>?8m2eIt:sHy;21s8 5DAg0n@8Gi2dDA58:o:>1cA F<8r@eD5Al0?;CCp5mC9DHEi3DDs7 I>42IaI
8= 0G1F7e3@;6A35s0@HuF 7B7e7w0F@ <:2>D;<tF?96En065o;;;@Ad= B5F6@C>91y7h:AF8FW

:D

ENJOY!

-- AI
 
  • #42
A hint...and a promise that that's not gibberish... ??
 
  • #43
My sincere apologies, the last code has an error ... something which i did not notice while i was generating that code ... I have changed the message and here i am giving a new code ...

E8!2!3s964iIh0F9tE B01t:0F0=p4yHEHCGr:1HcAeI10d3?A6; =@67=tFo248;0nB:6nIa651IEc1
@A @IAA;I

If one still requires a hint then here it is
::
My code is nothing
but a clever disguise;
a small amount of curry
with a lot of spice.

Its like searching a haystack
for a pin,
all one wants
is the position it is in.

Simple minds, simple thought.
Simple thoughts are always odd!
Rational expressions there are nought,
that capture the distribution in the pod.

Alas one may get now,
the message that he wants,
but to understand it,
it needs to be reflected upon.

I promise to thee,
its not gibberish.
It probably aint clever,
but certainly not childish.
[/Color]

-- AI
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
1K
Replies
3
Views
2K
  • · Replies 21 ·
Replies
21
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 43 ·
2
Replies
43
Views
6K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K