Neural Cryptography

This Demonstration shows how a neural-network key exchange protocol for encrypted communication works using the Hebbian learning rule. The idea is: the person A wants to communicate with the person B, but they cannot exchange a key through a secure channel, so they set two topologically identical neural networks and evaluate them with the same inputs until the weights of their respective networks match.
The "epoch" slider moves the system in time through the trained epochs while the "randomize" button creates a new configuration of the network. The system is said to be "paired" when the weights of both networks match. These networks are trained through 1000 epochs only and they may get stuck in a local minima state, so they may never come to a paired state.



  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


A and B set two neural networks with the same size and different random weights values with the property , where is the number of possible values the weight can take.
The algorithm is:
1. The input of the network is randomized with values .
2. Compute the value of the hidden neurons according to .
3. Compute the value of the output neuron .
4. Compare the outputs of both networks. If the outputs do not match, return to step 1. If they do match, update the weights of the network according to one of the following rules:
The Hebbian Learning Rule (used here):
The Anti-Hebbian Learning Rule:
Random walk:
5. Repeat the process until the weights of both neural networks are equal. The paired key is the value of the weights of the networks.
[1] Wikipedia. "Neural Cryptography." (May 19, 2011) en.wikipedia.org/wiki/Neural_cryptography.
[2] N. Prabakaran and P. Vivekanandan, "A New Security on Neural Cryptography with Queries," International Journal of Advanced Networking and Applications, 2(1), 2010 pp. 437-444.
[3] CyberTrone. "Neural Cyptography." The Code Project. (Aug 29, 2009) www.codeproject.com/KB/security/Neural_Cryptography1.aspx.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+