Skip to content

HaoPham23/PPML-with-CKKS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Privacy-preserving Machine Learning with Homomorphic Encryption

How to run

On local machine

  1. Run the server:
cd app/server
python3 server.py
  1. Run the client:
cd app/client
python3 client.py

On Docker

docker compose build
docker compose up

An example log:

Server:

kali@kali-virtual-machine:~/Desktop/do_an_AI/app/server$ python3 server.py 
-----------Server-----------
[+] Loading model
    [-] Model loaded!
 * Running on http://127.0.0.1:5000
[+] Received a request!
    [-] Received public key, size = 67.27 MB
    [-] Received encrypted input, size = 0.44 MB
    [-] Trying to predict on encrypted input...
    [-] Done, encrypted output size = 0.09 MB
[+] Total time: 2.2699689865112305 s

Client:

kali@kali-virtual-machine:~/Desktop/do_an_AI/app/client$ python3 client.py 
-----------Client-----------
[+] Initializing Key...
    [-] A key pair is generated!
    [-] The private key is stored locally! File size = 0.8 MB
    [-] The public key is stored locally! File size = 67.27 MB
    [-] Initialized!
[+] Picking a random example from dataset...
    [-] Got 3007th data, input = [-0.86705605 -0.06823785  0.02090219  1.01174906  0.92572593 -0.17582307
 -0.07702346 -0.67102175 -0.16245742  0.05140079 -0.42437453 -0.91458328
 -0.6023179  -1.15415546  0.        ], output = 0
    [-] Encrypting input...
    [-] Encrypting time = 0.43648409843444824 s
    [-] Posting encrypted input to server...
    [-] Received response! Decrypting the output...
    [-] Result output = False
    [-] Check? True
[+] Finished! Total time: 7.632829189300537 s

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published