DEV Community

Nikolay
Nikolay

Posted on

NeuroSync: An opensource python library for Neural Cryptography

Neural Cryptography is a really cool concept where two neural networks synchronize and learn to encrypt and decrypt information. But historically, it's mostly been an academic theory.

For my latest project, NeuroSync, I wanted to see if I could make a Python library that would make this concept usable for real data, as well as help researchers out there by allowing them to easily change the NN parameters and experiment with them.

The Problems I tried to solve:

One of the major issues with neural crypto is that the networks only sync with about 99.8% accuracy. In cryptography, one wrong bit ruins the whole message. I implemented a hash-matching and error-correction system to bridge that gap, giving the library 100% decryption accuracy so it can handle actual data streams.

Another main problem is the fact that the security of the cipher cant be practically assessed. That is why the I do not recommend using the library in any actual production-ready projects, especially since it is still work in progress. I tried to solve this problem by using adversarial training with another NN - Eve, that tries to break the cipher while the other two protect it. I also added a few static security checks to make sure nothing shady is happening.

It's still a Work in Progress!

This project is very much still in active development. There are bugs to squash and the "Eve" attacker network needs a major overhaul to provide a real challenge. But, the first version is finally out, and the core encryption interface is mostly working.

Come play with it!

You don't even need to install it. I've included a Jupyter Notebook in the repo where you can run the synchronization and watch the encryption happen right in your browser.

Check out the repo here: https://github.com/CooDiiNgg/NeuroSync

If you like what you see or want to support a student's open-source journey, a star on GitHub goes a long way!

Top comments (0)