Skip to content

Implementation of the "Algebra Homomorphic Encryption Scheme Based on Fermat's Little Theorem" (AHEF)

Notifications You must be signed in to change notification settings

rmrschub/ahefutil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ahefutil

Implementation of the "Algebra Homomorphic Encryption Scheme Based on Fermat's Little Theorem" (AHEF)

TODOS

  • Umbrella CLI
  • Support Radix-64 encoding (currently only HEX)
  • Make choice of encoding an OPTION
  • Replace json with json-ld (eat your own dogfood)
  • Fix precision issues
  • Implement grcy_mpi_rational using signed big integers (e.g. https://mattmccutchen.net/bigint/)

Usage

Generate two (very) large random primes as private keys (keep them secret):

./genpkey -o private_keys.json -k 1024

Extract public key from private keys:

./extract -p private_keys.json -o public_key.json

Use private keys to encrypt some values A=2.5 and B=1.3:

./encrypt -p private_keys.json -o A.enc -v 2.5
./encrypt -p private_keys.json -o B.enc -v 1.3

Use the public key to add two encrypted numbers together:

./addenc -p public_key.json -a A.enc -b B.enc -o C.enc

Use the public key to subtract an encrypted number from another encrypted number:

./subenc -p public_key.json -a A.enc -b B.enc -o D.enc

Use the public key to multiply two encrypted numbers:

./mulenc -p public_key.json -a A.enc -b B.enc -o E.enc

Use the private keys to decrypt the computation results:

./decrypt -p private_keys.json -c C.enc
./decrypt -p private_keys.json -c D.enc
./decrypt -p private_keys.json -c E.enc

Dependencies:

brew install libgcrypt brew tap nlohmann/json brew install nlohmann_json

About

Implementation of the "Algebra Homomorphic Encryption Scheme Based on Fermat's Little Theorem" (AHEF)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published