Omer Shlomovits on Tue, 05 Nov 2019 16:46:55 +0100

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Pari Library used with Rust : help with parallelism

Hello ,

My name is Omer Shlomovits and I work as a cryptographer for KZen Research (
As part of my work we implemented a Rust library that is using Pari c library for class groups operations:
The library is supposed to provide implementation for cryptographic primitives based on class groups. 
Our first primitive is based on a zero-knowledge proof from
Our version of the zk proof is non interactive and require repeating binary quadratic form exponentiation with n different values (and also n composition of two QFs). These operations should be good fit to run in parallel since the exponentiations are independent. However, working with Rust and calling the library functions from Rust, I can’t find a good way to support the necessary parallelism. This is unfortunate because this is exactly the gap between making the protocol from 2019/503 practical for our needs. 
What I have tried: 
- using the Rust "parallel for" over Pari library calls to “nupow” : I am getting stack overflow every time. No mattar what is the max size of the stack
- I tried Pari parfor: This option went better but I got illegal instruction error eventually. I think that it is because I don’t know how to write  “ i = 1 “ where i is a "formal variable” (I am not sure what is a formal variable). In my code I just use j (instead of writing i  = 1) as some Gen repressing a number. 
- I looked into parapply but I have no idea (maybe you do?) on how to write the function name as a "Gen f” when trying to invoke this method from Rust. 

To conclude: I exhausted my options and looking for new ways / ideas of what I am doing wrong with what I tried above.

Thanks in advance,