Saturday, February 6, 2010

Columnar Transposition technique using TMS 320C 5402


Although this is totally not related to Java or data structures for which this blog is intended to, I thought I would post this here anyway. This is my project work that I did during college. This implements Columnar Transposition technique of encryption using TMS 320C 5402 which is Digital Signal Processor. Full project report for this can be found here (you may require to sign in using your Google Account). License would be free to distribute and use anywhere.

ABSTRACT

Aim:
            To implement the columnar transposition technique, a famous encryption technique on the input message using TMSC5402.

Columnar Transposition technique:
           
            Here the message or plain text is encrypted into a decrypted message using the random arrangement of the plain text. The arrangement of the resulting cipher text although seems random to the hacker (unauthorized intermediate person trying to read the message), it is in certain order and that order is been decided by a key. The key is simply numbers from 1 to ‘k’, where ‘k’ is the key size. The numbers are in some random order, mostly decided by the user or the sender. A simple example is shown below.

Plain text                     :           ABSTRACT

Let the key ‘k’ be 7, 3, 2, 8, 1, 5, 4, 6

1
2
3
4
5
6
7
8
A
B
S
T
R
A
C
T

Then the encrypted cipher text is (according to our key)

Cipher text                  :           CSBTARTA

            This is the simplest form. As we can see the decryption can be done using the secret key that we have used for the encryption.

7
3
2
8
1
5
4
6
C
S
B
T
A
R
T
A

Decrypted text                        :           ABSTRACT

            This might look simple since we have used a small message. But this message is almost impossible to hack when we use rows and columns and increase the key size. Lets see another example which could explain it better.

Plain text         :           PACK$MY$BOX$WITH$FIVE$DOZEN$LIQUOR$JUGS$


1
2
3
4
5
6
7
8
P
A
C
K
$
M
Y
$
B
O
X
$
W
I
T
H
$
F
I
V
E
$
D
O
Z
E
N
$
L
I
Q
U
O
R
$
J
U
G
S
$

Here we have used the ‘$’ symbol instead of spaces.

Cipher text      :           YTDQSCXIN$AOFER$HOU$PB$ZO$WELUK$V$JMI$IG

Now the encrypted message is impossible to hack. We can even apply again this method to the encrypted message to make it further random. In this case we can use the same key or other key. Same key can be used for simplicity.


Decryption:

Decryption is as simple as encryption. Just use the same key and rewrite the indexed values. Lets do the decryption for the Cipher text 1.

Cipher text      :           YTDQSCXIN$AOFER$HOU$PB$ZO$WELUK$V$JMI$IG


7
3
2
8
1
5
4
6
Y
C
A
$
P
$
K
M
T
X
O
H
B
W
$
I
D
I
F
O
$
E
V
$
Q
N
E
U
Z
L
$
I
S
$
R
$
O
U
J
G

Now the original table can be formed using the indexing technique as said earlier.

1
2
3
4
5
6
7
8
P
A
C
K
$
M
Y
$
B
O
X
$
W
I
T
H
$
F
I
V
E
$
D
O
Z
E
N
$
L
I
Q
U
O
R
$
J
U
G
S
$

Decrypted text            : PACK$MY$BOX$WITH$FIVE$DOZEN$LIQUOR$JUGS$



Advantages of Columnar Transposition technique :

            The columnar transposition technique of encryption is easy to understand but still complex to break by brutal force attack or cryptanalysis. This method get enhances as the key size is increased and by re applying the same technique. The hacker or the intermediate person cannot break this code unless otherwise he knows the method. Even he knows the method, it is still impossible to decrypt the encrypted cipher text without the knowledge of the key and the length of it and the no. of columnar transpositions that were made. As we’ve seen, we can enhance this technique by applying to the encrypted text over and over. In that case, we have to decrypt that many times we have encrypted and use the keys in the reverse order (FILO).



Columnar Transposition technique using TMSC5402:
           
            This technique can be implemented in the 5402 processor. We can enter the text message from a starting address say 3FFFh. The key is got from the user or is specified in some predefined location rather than getting in the run time. Then the transposition technique as given above is done using the instruction set available and is stored from say some starting address 43FFh. The data is transmitted serially(assumption) and is retrieved in the same manner.
            The decryption is done in the same scale. Here we assume that the received message is error free and is available from the location 43FFh. The decryption is similarly performed as encryption with slight difference and is put in some other location. We might be using a special symbol in order to mark the end of message. In this method we will be implementing depth1 columnar transposition for simplicity and ease of use.

1 comment:

Rashmi said...

plz give c code of this program and token buket