kevinlewi / fhipe Goto Github PK
View Code? Open in Web Editor NEWAn implementation of Function-Hiding Inner Product Encryption
License: ISC License
An implementation of Function-Hiding Inner Product Encryption
License: ISC License
I would like to ask you what is the maximum length of vector that can be calculated. I tried to generate encryption parameters for a vector of length 1000, but it took too long. Is it theoretically possible to generate encryption parameters of this order of magnitude, and in practice?
In the file "ipe.py", the decrypt algorithm calls solve_dlog_bsgs
to find the descrete logorithm:
Line134: return solve_dlog_bsgs(t2, t1, max_innerprod+1)
This function implements the "baby-step, giant-step" algorithm. Its complexity should be O(\sqrt(max_innerprod + 1)), But the function looks like this:
def solve_dlog_bsgs(g, h, dlog_max):
"""
Attempts to solve for the discrete log x, where g^x = h, using the Baby-Step
Giant-Step algorithm. Assumes that x is at most dlog_max.
"""
alpha = int(math.ceil(math.sqrt(dlog_max))) + 1
g_inv = g ** -1
tb = {}
for i in range(alpha + 1):
tb[(g ** (i * alpha)).__str__()] = i
for j in range(alpha + 1):
s = (h * (g_inv ** j)).__str__()
if s in tb:
i = tb[s]
return i * alpha + j
return -1
The loop over j in the function is nested inside the loop over i, which means that the function still needs to make as many as \sqrt(max_innerprod + 1) loops. So it's not actually more efficient than function solve_dlog_naive
, even though it performs correctly.
From my testing, the correct BSGS algorithm can be achieved by simply unindenting j's loop so that it is parallel to i's loop.
This is just my view and it might not be entirely right. I hope it helps, though.
Hello !
I use fhipe to calculate the inner products of vectors, and it works pretty well if the product is positive.
but when the expected inner product is negative, it cann't find the correct result.
Could you give me some threads on using it to calculate the nenative product?
Thank you very much!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.