11,928,605 members (50,287 online)
alternative version

58.4K views
57 bookmarked
Posted

# Neural Cryptography

, 29 Aug 2009 CPOL
 Rate this:
This article presents a new cryptography algorithm based on neural networks. Here, you can find some theory and a demo project.

## 1. Abstract

There are many Cryptography algorithms nowadays. Some of them are more secure, some less. All those algorithms can be split into symmetric or asymmetric cryptography. In symmetric cryptography, the sender and receiver use a shared key to encode and decode plain text. In asymmetric algorithms, users have their own private and public keys. There are some advantages and disadvantages in both methods in terms of speed and level of security. I will just say that symmetric algorithms are a lot faster than asymmetric ones. But they do need a shared key. How can we get a shared key via a public channel and protect it against opponents? There are many ways to do this, which are more or less effective, but I want to offer a rather new and absolutely secure method: neural cryptography.

## 2. Requirements

• Familiarity with Delphi
• Some math knowledge about basic neural networks

## 3. Introduction

There are two guys: Alex and Boris, and an insecure channel (for example, ICQ). They want to send some top-secret information to each other. Also, they can't use RSA-like asymmetric algorithms, and they can't meet to create a secret key for their messages. What should they do? The answer is to build neural networks, one for each. Then, they should synchronize their networks, and the weights will be the secret key. This article implements a basic neural cryptography algorithm and a demo project written in Delphi to show its fantastic effect. It would be interesting for developers, cryptoanalytics, and those people who want to make their communication secure.

## 4. Background

This part explains some of the neural network theories you need to understand in Section 5.

Here is a simple neural network developed by Rosenblat in 1968. It consists of an input vector X, a hidden layer Sigma s, a weights coefficients W between the input vector and the hidden layer, and an activation procedure ? that counts the result value t. Let's call such a neural network a neural machine. It can be described by three parameters: K, the number of hidden neurons, N, the number of input neurons connected to each hidden neuron, and L, the maximum value for weight {-L..+L}. Two partners have the same neural machines. To synchronize them, they should execute such an algorithm:

To count the output value, we use a simple method:

How do we update the weights? We update the weights only if the output values of the neural machines are equal. There are three different rules:

 Hebbian learning rule Anti-Hebbian learning rule Random-walk learning rule

Here, Theta is a special function. Theta(a, b)=0 if a<>b; else Theta=1. The g(...) function keeps the weights in the range -L..+L. x is the input vector and w is the weights vector. After the machines are synchronized, their weights are equal: we can use them for constructing a shared key. In [3], there is a lot of information about the attacks on this algorithm. I just want to say here that it is impossible to hack it.

## 5. Implementation

In this section, I describe how to program neural machines and will show how to use the Delphi unit NeuroCrypt.pas.

The main object in this unit is tTPM (TPM - Tree Parity Machine in [3]). It contains two vectors: H and W. "H" is used for internal operations during result value counting. "W" contains weights. There are also four integer values: K, L, N, and TPOutput. Here is the interface of the `tTPM`, `tVector`, and `tInputVector` objects:

```tVector = array of integer;
tTPM = object
w,h:tVector;
K,N,L:integer;
TPOutput:integer;
Procedure InitAll;
Procedure CountResult(X:tVector);
Procedure UpdateWeight(X:tVector);
Procedure RandomWeight;
Function VectorValue:integer;
end;
tInputVector=object
X: TVector;
Procedure FormRandomVector(k,n:integer);
end;```

I think the names of the procedures say for themselves what they do. You can also download the source code from this site, and it's not necessary to explain it. Here I just show how to use it. First of all, we initialize the neural machine's properties:

```A: tTPM;
~~~~~~~~~~~~~~~~~~~~~
with A do
begin
K:=spinedit1.Value;
N:=spinedit2.Value;
L:=spinedit3.Value;
InitAll;
RandomWeight;
end;```

Then, in every iteration, we should produce the input vector, the count output value, and send them to the partner B. "B" should do the same.

```inp: tInputVector;
~~~~~~~~~~~~~~~~~~~~~
inp.FormRandomVector(b.K,b.N);
A.CountResult(inp.X);
if a.TPOutput=b.TPOutput then
begin
a.UpdateWeight(inp.X);
~~~~~~~~~~~~~~~~~~~~~~~~~~~
b.UpdateWeight(inp.X);
end;```

Here is a screenshot of the demo project based on NeuroCrypt:

## 6. Future Work

• Solve the problem of man-in-middle attacks when a man can change messages
• Build an add-on to ICQ/MSN client to secure messages

## 7. References

• [1] A New Technique on Neural Cryptography with Securing of Electronic Medical Records in Telemedicine System – N.Prabakaran, Department of Mathematics, Anna University, 2008
• [2] Cryptography based on delayed chaotic neural networks – Wenwu Yu, Department of Mathematics, Southeast University, 2006
• [3] Neural Synchronization and Cryptography — Andreas Ruttor. PhD thesis, Bayerische Julius-Maximilians-Universität Würzburg, 2006

## 8. History

• 18th August, 2009: Initial post.

## Share

 Other Russian Federation
Moscow State University of Economics, Statistics and Informatics (MESI) - diploma at 2010
-----------------------
Interesting in robot's navigation, machine learning, neural networks, 3D-graphics, cryptography
-----------------------
Delphi - for fun
C# - for work

## You may also be interested in...

 First Prev Next
 What textboks and papers you considered while making this project!!!!! Member 995731111-Aug-13 1:32 Member 9957311 11-Aug-13 1:32
 My vote of 5 Peter_Second8-Apr-12 12:37 Peter_Second 8-Apr-12 12:37
 A question for the author lokenxo8-Mar-12 10:28 lokenxo 8-Mar-12 10:28
 My vote of 5 Anand Inasu Chittilappilly26-Dec-11 23:25 Anand Inasu Chittilappilly 26-Dec-11 23:25
 My vote of 5 Filip D'haene13-Nov-11 11:11 Filip D'haene 13-Nov-11 11:11
 HI marsela2710-Jun-11 22:45 marsela27 10-Jun-11 22:45
 Hi, Cybertrone. [modified] BodomAnka11-Apr-11 14:16 BodomAnka 11-Apr-11 14:16
 Hi Cybertrone, pramodpavithran6-Feb-11 19:05 pramodpavithran 6-Feb-11 19:05
 found some vestigial code Kalmah14-Oct-10 17:55 Kalmah 14-Oct-10 17:55
 great work Member 3940511-Apr-10 1:10 Member 39405 11-Apr-10 1:10
 reply me.......... gspsvsl20-Mar-10 23:09 gspsvsl 20-Mar-10 23:09
 good work sskgd12-Mar-10 20:38 sskgd 12-Mar-10 20:38
 An Excellent Concept _Khallaf29-Aug-09 9:47 _Khallaf 29-Aug-09 9:47
 Re: An Excellent Concept CyberTrone30-Aug-09 10:02 CyberTrone 30-Aug-09 10:02
 Re: An Excellent Concept BodomAnka12-Apr-11 4:45 BodomAnka 12-Apr-11 4:45
 well konikula27-Aug-09 3:28 konikula 27-Aug-09 3:28
 I think this is very interesting article, and very educative. >But< ... if I was a third guy, which is bad one or almost worst of all, and if I knew which algorithm one of the other guys use, it should be enough for me to capture their synchronization, and sync also my NCM. I guess this is the same as exchanging symmetric keys, with only difference, that no key is exchanged, but states which with knowledge of method lead to key assembly. You can easily secure this channel, but isn't neural crypto-machine then just expensive decoration to our weak-secured symmetric key exchange (as you proposed - no option to meet personally to be initial condition). Isn't weakest element of security architecture its main (and only) measure?
 Re: well CyberTrone27-Aug-09 7:22 CyberTrone 27-Aug-09 7:22
 Re: well konikula27-Aug-09 9:34 konikula 27-Aug-09 9:34
 Re: well konikula27-Aug-09 11:10 konikula 27-Aug-09 11:10
 Re: well CyberTrone27-Aug-09 18:47 CyberTrone 27-Aug-09 18:47
 Re: well konikula27-Aug-09 18:56 konikula 27-Aug-09 18:56
 Re: well CyberTrone28-Aug-09 2:25 CyberTrone 28-Aug-09 2:25
 Re: well konikula28-Aug-09 4:10 konikula 28-Aug-09 4:10
 Re: well CyberTrone28-Aug-09 9:52 CyberTrone 28-Aug-09 9:52
 Re: well konikula29-Aug-09 8:42 konikula 29-Aug-09 8:42
 Re: well CyberTrone30-Aug-09 9:57 CyberTrone 30-Aug-09 9:57
 Re: well konikula30-Aug-09 16:43 konikula 30-Aug-09 16:43
 Re: well CyberTrone1-Sep-09 10:56 CyberTrone 1-Sep-09 10:56
 Re: well BodomAnka12-Apr-11 4:57 BodomAnka 12-Apr-11 4:57
 Can you upload the image with better resolution? nvs-ct25-Aug-09 12:04 nvs-ct 25-Aug-09 12:04
 Re: Can you upload the image with better resolution? CyberTrone25-Aug-09 21:31 CyberTrone 25-Aug-09 21:31
 Re: Can you upload the image with better resolution? nvs-ct26-Aug-09 4:05 nvs-ct 26-Aug-09 4:05
 Good work Gila Monster25-Aug-09 4:41 Gila Monster 25-Aug-09 4:41
 Re: Good work CyberTrone25-Aug-09 6:59 CyberTrone 25-Aug-09 6:59
 Last Visit: 31-Dec-99 19:00     Last Update: 28-Nov-15 11:41 Refresh 1