MathLock API capabilities and samples

Available applications, resources, APIs for Demo purpose:

  • 1) Flask backend server, which provides REST API capabilities
  • 2) Sample application which provides basic functionalities of our Python prototype for floating-points implementation (integers are disabled there)
  • 3) VM with PostgreSQL which we created in our Cloud for Demo purpose
  • 4) Sample application which provides basic functionalities to test PosgreSQL custom extension

Link to download samples:
https://github.com/Math-Lock/fully-homomorphic-encryption-practical-and-fast


Take a note, that performance is very limited due to network restrictions and API limitations It maybe around 10 operations per second, while general performance, for instance, addition operations give 3,000,000 ops/sec All information related to our performance and its comparison with existing implementations you may find here:
https://www.math-lock.com/benchmarks.html

Basic details to make samples work on Linux OS:

  • 1) Download samples from GitHub by given above link. It can be done using command "git clone https://github.com/Math-Lock/fully-homomorphic-encryption-practical-and-fast.git" or "git clone git@github.com:Math-Lock/fully-homomorphic-encryption-practical-and-fast.git"
  • 2) Make sure that you have python 3.6, 3.7 or 3.8 (recommended) or above - installed
  • 3) Make sure that you refer to correct python interpreter path, and correct python alias. It shall be python3.6, python3.7 etc
  • 4) Make sure to install correct pip and upgrade it a) sudo apt install python3-pip and b) sudo python3.x -m pip install --upgrade pip
  • 5) Go into the repository folder after download and execute "sudo python3.x -m pip install -r samples_requirements.txt" to install all package dependencies. Or in case you use your venv - define it respectfully for it
  • 6) sample_mathlock_rest.py works out of the box - just launch it as is
  • 7) sample_postgres.py also works out of the box, but required to define table name, by default it's empty string. So open file sample_postgres.py and define it for variable tab_name in method run() It shall be in snake_case, for instance: 'my_unique_test_table'.
    It wasn't defined because we want to make sure every user define own name to not disturb to each other

Basic details to make samples work on Windows OS:

  • 1) Download samples from GitHub by given above link. It can be done using command "git clone https://github.com/Math-Lock/fully-homomorphic-encryption-practical-and-fast.git" or "git clone git@github.com:Math-Lock/fully-homomorphic-encryption-practical-and-fast.git"
  • 2) Make sure that you have python 3.6, 3.7 or 3.8 (recommended) or above - installed
  • 3) Go into the repository folder after download and execute "py -3.x -m pip install -r samples_requirements.txt" to install all package dependencies. Or in case you use your venv - define it respectfully for it
  • 4) sample_mathlock_rest.py works out of the box - just launch it as is
  • 5) sample_postgres.py also works out of the box, but required to define table name, by default it's empty string. So open file sample_postgres.py and define it for variable tab_name in method run() It shall be in snake_case, for instance: 'my_unique_test_table'.
    It wasn't defined because we want to make sure every user define own name to not disturb to each other

Depends on your programming skills and capabilities - feel free to play with samples and its implementation. Both samples are written in a very minimalistic and simple way to work out of the box.


Short explanation about PostgreSQL MathLock extension:

We have implemented custom extension where introduced new data type - 'mathlock'. Whenever we send data to our demo db, it will be saved there in this specific format. Demo db is capable to do the following things: store encrypted data in our format, query data, perform +,-,/,* homomorphic arithmetic operations with user data.