Git Product home page Git Product logo

ntru's Introduction

NTRU for Python 2.7

Description

An important problem in data analytics is how to collect user data and make it available for analysis without compromising user privacy. A recommended solution is to encrypt data using ring homomorphism methods which allows analysis to be performed on encrypted data, allowing the analyst to perform analytics on the data without knowing the individual private data elements used in the analysis. Previous research showed that the existing NTRU encryption system could be modified to provide just this level of functionality, but open source tools do not currently exist to support NTRU on Python.

Our project is the creation of a python library of functions which implement the algorithms necessary for an NTRU. We have built a python package which provides an implementation of NTRU Encryption System.

To ensure accuracy of the encryption and decryption we required to know polynomials with high accuracy. Since existing polynomial libraries such as the one provided by the Numpy Python Package has coefficients as floats, we could not employ them. Therefore, we implemented a fresh polynomial package which allows us to perform operations on polynomial with rational coefficients(using fraction datatype Python).

Software:

Polynomial Package

  • poly.py : Polynomial Library for polynomials with rational coeffiencents
  • POLY.md : Documentation for poly.py
  • testPoly.py : A test for functions defined in our library

Ntru Package

  • ntru.py : Ntru Encryption Class Implimentation for Python
  • NTRU.md : Documentation for ntru.py
  • example_bobalice.py : An example using Ntru given in the Ntru Documentation NTRU.md
  • example_enDom.py : An example using Ntru in context of encrypted domain

Helper Functions

  • fracModulo.py : Contains Implementation of Extented Euclidean Algorithm for Integers, Modular Inverse of an integer and x Modulo m where x can be a fraction or integer.

Documentation

License and documentation are both provided in the Documentation folder.

Technical Details

Technical details can be found in Presentation and Report folder

ntru's People

Contributors

ak3674columbia avatar khansamad47 avatar paqman85 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ntru's Issues

this is easy to break

I am not sure if this is just an issue with the implementation, my conversion to python 3 or the encryption scheme itself but when you encrypt if the message is a 0 it will always either end with a 0 or a 5 and if the message is a 1 it will always end with a 6 or a 1. if you just add this bit of code under
if message == 1:
sum=sum + 1

`it breaks the encryption every time.

print ('Encrypted is:',sum)
if list(str(sum))[len(list(str(sum)))-1] == '6' or list(str(sum))[len(list(str(sum)))-1] == '1':
print ('the message is 1. this was easily cracked')
else:
print ('the message is 0. this was easily cracked')

Python 3 update

Since Python 2 is going to be deprecated, is it possible to update this repo.

Entropy source

Hi,

Great Job! Simple, but effective code. However, for me is not clear what is your source of entropy? How can you change the source/stream of the entropy.

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.